diff --git "a/data_all_eng_slimpj/shuffled/split2/finalzzlmub" "b/data_all_eng_slimpj/shuffled/split2/finalzzlmub" new file mode 100644--- /dev/null +++ "b/data_all_eng_slimpj/shuffled/split2/finalzzlmub" @@ -0,0 +1,5 @@ +{"text":"\\section{introduction}\nAlignment of surfaces plays a role in a wide range of scientific\ndisciplines. It is a standard problem in comparing different scans\nof manufactured objects; various algorithms have been proposed for\nthis purpose in the computer graphics literature. It is often also\na crucial step in a variety of problems in medicine and biology; in\nthese cases the surfaces tend to be more complex, and the alignment\nproblem may be harder. For instance, neuroscientists studying brain\nfunction through functional Magnetic Resonance Imaging (fMRI)\ntypically observe several people performing identical tasks,\nobtaining readings for the corresponding activity in the brain\ncortex of each subject. In a first approximation, the cortex can be\nviewed as a highly convoluted 2-dimensional surface. Because\ndifferent cortices are folded in very different ways, a synthesis of\nthe observations from different subjects must be based on\nappropriate mappings between pairs of brain cortex surfaces, which\nreduces to a family of surface alignment problems\n\\cite{Fischl99,Haxby09}. In another example, paleontologists\nstudying molar teeth of mammals rely on detailed comparisons of the\ngeometrical features of the tooth surfaces to distinguish species or\nto determine similarities or differences in diet \\cite{Jukka07}.\n\nMathematically, the problem of surface alignment can be described as\nfollows: given two 2-surfaces $\\mathcal{M}$ and $\\mathcal{N}$, find a mapping $f:\\mathcal{M}\n\\rightarrow \\mathcal{N}$ that preserves, as best possible, ``important\nproperties'' of the surfaces. The nature of the ``important\nproperties'' depends on the problem at hand. In this paper, we\nconcentrate on preserving the geometry, i.e., we would like the map\n$f$ to preserve intrinsic distances, to the extent possible. In\nterms of the examples listed above, this is the criterion\ntraditionally selected in the computer graphics literature; it also\ncorresponds to the point of view of the paleontologists studying\ntooth surfaces. To align cortical surfaces, one typically uses the\nTalairach method \\cite{Lancaster00} (which relies on geometrically\ndefined landmarks and is thus geometric in nature as well), although\nalignment based on functional correspondences has been proposed more\nrecently \\cite{Haxby09}.\n\nIn this paper we propose a procedure to ``geometrically'' align\nsurfaces, based on uniformization theory and optimal mass\ntransportation. This approach is related to the computer graphics\nconstructions in \\cite{Lipman:2009:MVF}, which rely on the\nrepresentation of isometries between topologically equivalent\nsimply-connected surfaces by M\\\"{o}bius transformations between\ntheir uniformization spaces, and which exploit that 1) the\nM\\\"{o}bius group has small dimensionality (e.g. 3 for disk-type\nsurfaces and 6 for sphere-type) and 2) changing the metric in one\npiece of a surface has little influence on the uniformization of\ndistant parts. These two observations lead, in\n\\cite{Lipman:2009:MVF}, to fast and particularly effective\nalgorithms to identify near-isometries between differently deformed\nversions of a surface. In our present context, these same\nobservations lead to a simple algorithm for surface alignment,\nreducing it to a linear programming problem.\n\nWe shall restrict ourselves to (sufficiently smooth) disk-type\nsurfaces; we map them to metric densities defined on the hyperbolic\ndisk, their canonical uniformization space. (Apart from simplifying\nthe description of the surface, this also removes any effect of\nglobal translations and rotations on the description of each\nindividual surface.) The alignment problem can then be studied in\nthe framework of Kantorovich mass-transportation\n\\cite{Kantorovich1942} between these metric densities, as follows.\nMass-transportation seeks to minimize the ``average distance'' over\nwhich mass needs to be ``moved'' (in the most efficient such moving\nprocedure) to transform one mass density $\\mu$ into another, $\\nu$.\nIn our case the uniformizing metric density (or conformal factor)\ncorresponding to an initial surface is not unique, but is defined\nonly up to a M\\\"{o}bius transformation. Because a na\\\"{\\i}ve\napplication of mass-transportation on the hyperbolic disk would not\npossess the requisite invariance under M\\\"{o}bius transformations,\nwe generalize the mass-transportation framework, and replace the\nmetric $d(x,y)$ traditionally used in defining the ``average\ndisplacement distance'' by a metric that depends on $\\mu$ and $\\nu$,\nmeasuring the dissimilarity between the two metric densities on\nneighborhoods of $x$ and $y$. Introducing neighborhoods also makes\nthe definition less sensitive to noise in practical applications.\nThe optimal way of transporting mass in this generalized framework,\nin which the orientation in space of the original surfaces is\n``factored away'', automatically defines a corresponding optimal way\nof aligning the surfaces.\n\nOur approach also allows us to define a new distance between\nsurfaces. The average distance over which mass needs transporting\n(to transform one metric density into the other) quantifies the\nextent to which the two surfaces differ; we prove that it defines a\ndistance metric between surfaces.\n\nOther distances between surfaces have been used recently for several\napplications \\cite{memoli07}. A prominent mathematical approach to\ndefine distances between surfaces considers the surfaces as special\ncases of \\emph{metric spaces}, and uses then the Gromov-Hausdorff\n(GH) distance between metric spaces \\cite{Gromov06}. The GH distance\nbetween metric spaces $X$ and $Y$ is defined through examining all\nthe isometric embedding of $X$ and $Y$ into (other) metric spaces;\nalthough this distance possesses many attractive mathematical\nproperties, it is inherently hard computationally\n\\cite{memoli05,BBK06}. For instance, computing the GH distance is\nequivalent to a non-convex quadratic programming problem; solving\nthis directly for correspondences is equivalent to integer quadratic\nassignment, and is thus NP-hard \\cite{Cela98}. In addition, the\nnon-convexity implies that the solution found in practice may be a\nlocal instead of a global minimum, and is therefore not guaranteed\nto give the correct answer for the GH distance. The distance metric\nbetween surfaces that we define in this paper does not have these\nshortcomings: because the computation of the distance between\nsurfaces in our approach can be recast as a linear program, it can\nbe implemented using efficient polynomial algorithms that are\nmoreover guaranteed to converge to the correct solution.\n\nIt should be noted that in \\cite{memoli07}, Memoli generalizes the\nGH distance of \\cite{memoli05} by introducing a quadratic mass\ntransportation scheme to be applied to metric spaces already\nequipped with a measure (mm spaces); he notes that the computation\nof this Gromov-Wasserstein distance for mm spaces is somewhat easier\nand more stable to implement than the original GH distance. In our\napproach we do not need to equip the surfaces we compare with a\nmeasure: after uniformization reduces the problem to comparing two\ndisks, we naturally \"inherit\" two corresponding conformal factors\nthat we interpret as measure densities, for which we then apply an\napproach similar to the one proposed in \\cite{memoli07}. Another\ncrucial aspect in which our work differs from \\cite{memoli07} is\nthat, in contrast to the (continuous) quadratic programming method\nproposed in \\cite{memoli07} to compute the Gromov-Wasserstein\ndistance between mm spaces, our conformal approach leads to a convex\n(even linear) problem, solvable via a linear programming method.\n\n\nIt is worth mentioning that optimal mass transportation has been\nused as well, in the engineering literature to define interesting\nmetrics between images; in this context metric is often called the\nWasserstein distance. The seminal work for this image analysis\napproach is the paper by Rubner et al.~\\cite{Rubner2000-TEM}, in\nwhich images are viewed as discrete measures, and the distance is\ncalled appropriately the ``Earth Mover's Distance''.\n\nAnother related method is presented in the papers of Zeng et al.\n\\cite{Gu2008_a,Gu2008_b}, which also use the uniformization space to\nmatch surfaces. Our work differs from that of Zeng et al. in that\nthey use prescribed feature points (defined either by the user or by\nextra texture information) to calculate an interpolating harmonic\nmap between the uniformization spaces, and then define the final\ncorrespondence as a composition of the uniformization maps and this\nharmonic interpolant. This procedure is highly dependent on the\nprescribed feature points, provided as extra data or obtained from\nnon-geometric information. In contrast, our work does not use any\nprescribed feature points, or external data, and makes use of only\nthe geometry of the surface; in particular we make use of the\nconformal structure itself to define deviation from (local)\nisometry.\n\nOur paper is organized as follows: in Section \\ref{s:prelim} we\nbriefly recall some facts about uniformization and optimal mass\ntransportation that we shall use, at the same time introducing our\nnotation. Section \\ref{s:optimal_vol_trans_for_surfaces} contains\nthe main results of this paper, constructing the distance metric\nbetween disk-type surfaces, in several steps. Section\n\\ref{s:the_discrete_case_implementation} discusses various issues\nthat concern the numerical implementation of the framework we\npropose; Section \\ref{s:examples} illustrates our results with a few\nexamples.\n\n\n\\section{Background and Notations}\n\\label{s:prelim}\n\n\nAs described in the introduction, our framework makes use of two\nmathematical theories: uniformization theory, to represent the\nsurfaces as measures defined on a canonical domain, and optimal mass\ntransportation, to align the measures. In this section we recall\nsome of their basic properties, and we introduce our notations.\n\n\\subsection{Uniformization}\n\nBy the celebrated uniformization theory for Riemann surfaces (see\nfor example \\cite{Springer57,Farkas92}), any simply-connected\nRiemann surface is conformally equivalent to one of three canonical\ndomains: the sphere, the complex plane, or the unit disk. Since\nevery 2-manifold surface $\\mathcal{M}$ equipped with a smooth Riemannian\nmetric $g$ has an induced conformal structure and is thus a Riemann\nsurface, uniformization applies to such surfaces. Therefore, every\nsimply- connected surface with a Riemannian metric can be mapped\nconformally to one of the three canonical domains listed above. We\nshall consider surfaces $\\mathcal{M}$ that are topologically equivalent to\ndisks and that come equipped with a Riemannian metric tensor $g$\n(possibly inherited from the standard 3D metric if the surface is\nembedded in $\\mathbb{R}^3$). For each such $\\mathcal{M}$ there exists a conformal\nmap $\\phi:\\mathcal{M} \\rightarrow \\D$, where $\\D =\\{z \\ | \\ |z|<1\\}$ is the\nopen unit disk. The map $\\phi$ pushes $g$ to a metric on $\\D$;\ndenoting the coordinates in $\\D$ by $z=x^1+\\bfi x^2$, we can write\nthis metric as\n$$\n\\wt{g} = \\phi_* g = \\widetilde{\\mu}(z)\\, \\delta_{ij}\\, dx^i \\otimes\ndx^j,\n$$\nwhere $\\widetilde{\\mu}(z)>0$, Einstein summation convention is used,\nand the subscript $*$ denotes the ``push-forward'' action. The\nfunction $\\widetilde{\\mu}$ can also be viewed as the \\emph{density\nfunction} of the measure $\\Vol_\\mathcal{M}$ induced by the Riemann volume\nelement: indeed, for (measurable) $A \\subset \\mathcal{M}$,\n\\begin{equation}\\label{e:volume_element}\n \\Vol_\\mathcal{M}(A) = \\int_{\\phi(A)} \\widetilde{\\mu}(z) \\, dx^1\\wedge dx^2.\n\\end{equation}\n\nIt will be convenient to use the hyperbolic metric on the unit disk\n$(1-|z|^2)^{-2}\\delta_{ij} dx^i \\otimes dx^j$ as a reference metric,\nrather than the standard Euclidean $\\delta_{ij} dx^i \\otimes dx^j$;\nnote that they are conformally equivalent (with conformal factor\n$(1-|z|^2)^{-2}$). Instead of the density $\\widetilde{\\mu}(z)$, we\nshall therefore use the {\\em hyperbolic density function}\n\\begin{equation}\\label{e:relation_hyperbolic_euclidean_density}\n\\mu^H(z):=(1-|z|^2)^{2}\\,\\widetilde{\\mu}(z)\\,,\n\\end{equation}\nwhere the superscript $H$ stands for hyperbolic. We shall often drop\nthis superscript: unless otherwise stated $\\mu=\\mu^H$, and\n$\\nu=\\nu^H$ in what follows. The density function $\\mu=\\mu^H$\nsatisfies\n$$\\Vol_\\mathcal{M}(A) = \\int_{\\phi(A)} \\mu(z)\\, d\\vol_H(z)\\,,$$\nwhere $d\\vol_H(z)=(1-|z|^2)^{-2}\\, dx^1\\wedge dx^2$.\n\nThe conformal mappings of $\\D$ to itself are the disk-preserving\nM\\\"{o}bius transformations $m \\in \\Md$, a family with three real\nparameters, defined by\n\\begin{equation}\\label{e:disk_mobius}\n m(z) = e^{\\bfi \\theta}\\frac{z-a}{1-\\bar{a}z}, \\ a\\in \\D, \\ \\theta \\in [0,2\\pi).\n\\end{equation}\nSince these M\\\"{o}bius transformations satisfy\n\\begin{equation}\\label{e:disk_mobius_is_isometry_of_hyperbolic_geom}\n (1-|m(z)|^2)^{-2}|m'(z)|^2 = (1-|z|^2)^{-2} \\,,\n\\end{equation}\nwhere $m'$ stands for the derivatives of $m$, the pull-back of $\\mu$\nunder a mapping $m\\in \\Md$ takes on a particularly simple\nexpression. Setting $w=m(z)$, with $w=y^1+\\bfi y^2$, and\n$\\widetilde{g}(w)=\\widetilde{\\mu}(w)\\delta_{ij}dy^i\\otimes dy^j =\n\\mu(w) (1-|w|^2)^{-2}\\delta_{ij}dy^i\\otimes dy^j$, the definition\n\\[\n(m^*\\widetilde{g})(z)_{kl}\\,dx^{k}\\otimes dx^{\\ell} :=\n\\mu(w)\\,(1-|w|^2)^{-2}\\,\\delta_{ij} \\, dy^{i}\\otimes dy^{j}\n\\]\nimplies\n\\begin{align*}\n(m^*\\widetilde{g})_{k\\ell}(z)\\,dx^{k}\\otimes dx^{\\ell} &=\\mu(m(z))(1-|m(z)|^2)^{-2}\\,\\delta_{ij}\\,\\frac{\\partial y^i}{\\partial x^k}\\,\\frac{\\partial y^j}{\\partial x^\\ell} \\,dx^{k}\\otimes dx^{\\ell}\\\\\n&= \\mu(m(z))\\,(1-|m(z)|^2)^{-2}\\,|m'(z)|^2\\,\\delta_{k\\ell} \\,dx^{k}\\otimes dx^{\\ell}\\\\\n&=\\mu(m(z))\\,(1-|z|^2)^{-2}\\,\\delta_{k\\ell}\\,dx^{k}\\otimes dx^{\\ell}.\\\\\n\\end{align*}\nIn other words, $(m^*\\widetilde{g})(z)_{kl}\\,dx^{k}\\otimes\ndx^{\\ell}$ takes on the simple form\n$m^*\\mu(z)\\,(1-|z|^2)^{-2}\\,\\delta_{kl}\\,dx^{k}\\otimes dx^{\\ell}$,\nwith\n\\begin{equation}\\label{e:pullback_of_metric_density_mu_by_mobius}\n m^*\\mu(z) = \\mu(m(z)).\n\\end{equation}\nLikewise, the push-forward, under a disk M\\\"{o}bius transform\n$m(z)=w$, of the diagonal Riemannian metric defined by the density\nfunction $\\mu=\\mu^H$, is again a diagonal metric, with (hyperbolic)\ndensity function $m_{*}\\mu (w)=\\left(m_{*}\\mu \\right)^H(w)$ given by\n\\begin{equation}\\label{e:push_forward_of_metric_density}\n m_* \\mu(w) = \\mu(m^{-1}(w)).\n\\end{equation}\n\nIt follows that checking whether or not two surfaces $\\mathcal{M}$ and $\\mathcal{N}$\nare isometric, or searching for (near-)\\ isometries between $\\mathcal{M}$ and\n$\\mathcal{N}$, is greatly simplified by considering the conformal mappings\nfrom $\\mathcal{M}$, $\\mathcal{N}$ to $\\D$: once the (hyperbolic) density functions\n$\\mu$ and $\\nu$ are known, it suffices to identify $m \\in \\Md$ such\nthat $\\nu(m(z))$ equals $\\mu(z)$ (or ``nearly'' equals, in a sense\nto be made precise). This was exploited in \\cite{Lipman:2009:MVF} to\nconstruct fast algorithms to find corresponding points between two\ngiven surfaces.\n\n\\subsection{Optimal mass transportation}\n\nOptimal mass transportation was introduced by G. Monge\n\\cite{Monge1781}, and L. Kantorovich \\cite{Kantorovich1942}. It\nconcerns the transformation of one mass distribution into another\nwhile minimizing a cost function that can be viewed as the amount of\nwork required for the task. In the Kantorovich formulation, to which\nwe shall stick in this paper, one considers two measure spaces\n$X,Y$, a probability measure on each, $\\mu \\in P(X)$, $\\nu \\in\nP(Y)$ (where $P(X),P(Y)$ are the respective probability measure\nspaces on $X$ and $Y$), and the space $\\Pi(\\mu,\\nu)$ of probability\nmeasures on $X \\times Y$ with marginals $ \\mu$ and $\\nu$ (resp.),\nthat is, for $A\\subset X$, $B\\subset Y$, $\\pi(A\\times Y) = \\mu(A)$\nand $\\pi(X \\times B) = \\nu(B)$. The \\emph{optimal} mass\ntransportation is the element of $\\Pi(\\mu,\\nu)$ that minimizes\n$\\int_{X \\times Y}d(x,y)d\\pi(x,y)$, where $d(x,y)$ is a cost\nfunction. (In general, one should consider an infimum rather than a\nminimum; in our case, $X$ and $Y$ are compact, $d(\\cdot,\\cdot)$ is\ncontinuous, and the infimum is achieved.) The corresponding minimum,\n\\begin{equation}\\label{e:basic_Kantorovich_transporation}\n T^R_d(\\mu,\\nu) = \\mathop{\\inf}_{\\pi \\in \\Pi(\\mu,\\nu)}\\int_{X \\times Y}d(x,y)d\\pi(x,y),\n\\end{equation}\nis the optimal mass transportation distance between $\\mu$ and $\\nu$,\nwith respect to the cost function $d(x,y)$.\n\nIntuitively, one can interpret this as follows: imagine being\nconfronted with a pile of sand on the one hand ($\\mu$), and a hole\nin the ground on the other hand ($-\\nu$), and assume that the volume\nof the sand pile equals exactly the volume of the hole (suitably\nnormalized, $\\mu,\\nu$ are probability measures). You wish to fill\nthe hole with the sand from the pile ($\\pi \\in \\Pi(\\mu,\\nu)$), in a\nway that minimizes the amount of work (represented by $\\int\nd(x,y)d\\pi(x,y)$, where $d(\\cdot,\\cdot)$ can be thought of as a\ndistance function). In the engineering literature, the distance\n$T^R_d(\\mu,\\nu)$ is often called the ``earth mover's distance''\n\\cite{Rubner2000-TEM}, a name that echoes this intuition.\n\nIn what follows, we shall apply this framework to the density\nfunctions $\\mu$ and $\\nu$ on the hyperbolic disk $\\D$ obtained by\nconformal mappings from two surfaces $\\mathcal{M}$, $\\mathcal{N}$, as described in the\nprevious subsection.\n\nThe main obstacle to applying the Kantorovich transportation\nframework directly is that the density $\\mu$, characterizing the\nRiemannian metric on $\\D$ obtained by pushing forward the metric on\n$\\mathcal{M}$ via the uniformizing map $\\phi:\\mathcal{M} \\rightarrow \\D$, is not\nuniquely defined: another uniformizing map $\\phi':\\mathcal{M} \\rightarrow \\D$\nmay well produce a different $\\mu'$. Because the two representations\nare necessarily isometric ($\\phi^{-1} \\circ \\phi'$ maps $\\mathcal{M}$\nisometrically to itself), we must have $\\mu'(m(z))=\\mu(z)$ for some\n$m \\in \\Md$. (In fact, $m=\\phi' \\circ \\phi^{-1}$.) In a sense, the\nrepresentation of (disk-type) surfaces $\\mathcal{M}$ as measures over $\\D$\nshould be considered ``modulo'' the disk M\\\"{o}bius transformations.\n\nWe thus need to address how to adapt the optimal transportation\nframework to factor out this M\\\"{o}bius transformation ambiguity.\nThis is done by designing a special distance (or cost) functional\n$d^R_{\\mu,\\nu}(z,w)$ that {\\em depends} on the conformal densities\n$\\mu$ and $\\nu$ representing the two surfaces. (A fairly simple\nargument shows that a cost function that does not depend on $\\mu$\nand $\\nu$ allows only trivial answers, such as $d(z,w)=0$ for all\n$z,w$.) As we shall see in the next section,\nthis cost function will have an intuitive explanation:\n$d^R_{\\mu,\\nu}(z,w)$ will measure how well an $R$-sized neighborhood\nof $z$ with density $\\mu$ can be matched isometrically to an\n$R$-sized neighborhood of $w$ with density $\\nu$ by means of a disk\nM\\\"{o}bius transformation.\n\n\n\\section{Optimal volume transportation for surfaces}\n\\label{s:optimal_vol_trans_for_surfaces} We want to measure\ndistances between surfaces by using the Kantorovich transportation\nframework to measure the transportation between the metric densities\non $\\D$ obtained by uniformization applied to the surfaces. The main\nobstacle is that these metric densities are not uniquely defined;\nthey are defined up to a M\\\"{o}bius transformation. In particular,\nif two densities $\\mu$ and $\\nu$ are related by $\\nu=m_*\\mu$ (i.e.\n$\\mu(z)=\\nu(m(z))$), where $m \\in \\Md$, then we want our putative\ndistance between $\\mu$ and $\\nu$ to be zero, since they describe\nisometric surfaces, and could have been obtained by different\nuniformization maps of the same surface. A standard approach to\nobtain quantities that are invariant under the operation of some\ngroup (in our case, the disk M\\\"{o}bius transformations) is by\nminimizing over the possible group operations. For instance, we\ncould set\n\\[\n\\mbox{Distance}(\\mu,\\nu)=\\inf_{m \\in \\Md} \\left( \\inf_{\\pi \\in\n\\Pi(m_*\\mu, \\nu)}\\,\\int_{\\D \\times \\D} d(z,w)\\,d\\pi(z,w)\\,\\right)\\,,\n\\]\nwhere $\\Pi(\\mu, \\nu)$ is the set of probability measures on $\\D\n\\times \\D$ with marginals $\\mu \\,\\vol_H$ and $\\nu \\,\\vol_H$. In\norder for this to be computationally feasible, we would want the\nminimum to be achieved in some $m$, which would depend on $\\mu$ and\n$\\nu$ of course; let's denote this special minimizing $m \\in \\Md$ by\n$m_{\\mu,\\nu}$. This would mean\n\\begin{align}\n\\mbox{Distance}(\\mu,\\nu)&= \\inf_{\\pi \\in \\Pi([m_{\\mu,\\nu}]_*\\mu,\n\\nu)}\\,\\int_{\\D \\times \\D}\nd(z,w)\\,d\\pi(z,w)\\nonumber\\\\\n&=\\inf_{\\pi \\in \\Pi(\\mu, \\nu)}\\,\\int_{\\D \\times \\D}\nd(m_{\\mu,\\nu}(z),w)\\,d\\pi(z,w)\\,.\\label{id_Dist}\n\\end{align}\nIf $\\nu$ were itself already equal to $m'_*\\mu$, for some $m' \\in\n\\Md$, then we would expect the minimizing M\\\"{o}bius transformation\nto be $m_{\\mu,\\nu}=m'$; for $\\pi$ supported on the diagonal\n$\\verb\"d\"=\\{(z,z)\\,;\\,z \\in \\D\\}\\subset \\D \\times \\D$, defined by\n$\\pi(A)=\\int_{A_2} \\nu(w)\\, d\\vol_H(w)$, with $A_2= \\{w; (w,w) \\in\nA\\}$, one would then indeed have $\\int_{\\D \\times\n\\D}d(m_{\\mu,\\nu}(z),w)\\,d\\pi(z,w)=0$, leading to\n$\\mbox{Distance}(\\mu,m'_*\\mu)=0$. From (\\ref{id_Dist}) one sees that\nthis amounts to using the same formula as for the standard\nKantorovich approach with just one change: {\\em the cost function\ndepends on} $\\mu$ and $\\nu$.\n\nWe shall use a variant on this construction, retaining the principle\nof using cost functions $d(\\cdot,\\cdot)$ in the integrand that\ndepend on $\\mu$ and $\\nu$, without picking them necessarily of the\nform $d(m_{\\mu,\\nu}(z),w)$. In addition to introducing such a\ndependence, we also wish to incorporate some robustness into the\nevaluation of the distance between (or dissimilarity of) $\\mu$ and\n$\\nu$. We shall do this by using a cost function\n$d^R_{\\mu,\\nu}(z,w)$ that depends on a comparison of the behavior\n$\\mu$ and $\\nu$ on {\\em neighborhoods} of $z$ and $w$, mapped by $m$\nranging over $\\Md$. The next subsection shows precisely how this is\ndone.\n\n\\subsection{Construction of $d^R_{\\mu,\\nu}(z,w)$}\n\nWe construct $d^R_{\\mu,\\nu}(z,w)$ so that it indicates the extent to\nwhich a neighborhood of the point $z$ in $(\\D,\\mu)$, the (conformal\nrepresentation of the) first surface, is isometric with a\nneighborhood of the point $w$ in $(\\D,\\nu)$, the (conformal\nrepresentation of the) second surface. We will need to define two\ningredients for this: the neighborhoods we will use, and how we\nshall characterize the (dis)similarity of two neighborhoods,\nequipped with different metrics.\n\nWe start with the neighborhoods.\n\nFor a fixed radius $R>0$, we define $\\Omega_{z_0,R}$ to be the\nhyperbolic geodesic disk of radius $R$ centered at $z_0$. The\nfollowing gives an easy procedure to construct these disks. If\n$z_0=0$, then the hyperbolic geodesic disks centered at $z_0=0$ are\nalso ``standard'' (i.e. Euclidean) disks centered at 0:\n$\\Omega_{0,R} = \\{z \\,;\\, |z|\\leq r_R \\}$, where\n$r_R=\\mbox{arctanh}(r)=R$. The hyperbolic disks around other centers\nare images of these central disks under M\\\"{o}bius transformations\n(= hyperbolic isometries): setting\n$m(z)=(z-z_0)(1-z\\bar{z_0})^{-1}$, we have\n\\begin{equation}\\label{e:neighborhood_def}\n \\Omega_{z_0,R} = m^{-1}(\\Omega_{0,R})\\,.\n\\end{equation}\nIf $m'$, $m''$ are two maps in $\\Md$ that both map $z_0$ to 0, then\n$m'' \\circ (m')^{-1}$ simply rotates $\\Omega_{0,R}$ around its\ncenter, over some angle $\\theta$ determined by $m'$ and $m''$. From\nthis observation one easily checks that (\\ref{e:neighborhood_def})\nholds for {\\em any} $m \\in \\Md$ that maps $z_0$ to $0$. In fact, we\nhave the following more general\n\\begin{lem}\\label{lem:m(omega_z)=omega_w}\nFor arbitrary $z,w \\in \\D$ and any $R>0$, every disk M\\\"{o}bius\ntransformation $m\\in \\Md$ that maps $z$ to $w$ (i.e. $w=m(z)$) also\nmaps $\\Omega_{z,R}$ to $\\Omega_{w,R}$.\n\\end{lem}\n\nNext we define how to quantify the (dis)similarity of the pairs\n$\\left(\\Omega_{z_0,R}\\,,\\, \\mu\\,\\right)$ and\n$\\left(\\Omega_{w_0,R}\\,,\\, \\nu\\,\\right)$. Since (global) isometries\nare given by the elements of the disk-preserving M\\\"{o}bius group\n$\\Md$, we will test the extent to which the two patches are\nisometric by comparing $\\left(\\Omega_{w_0,R}\\,,\\, \\nu\\,\\right)$ with\nall the images of $\\left(\\Omega_{z_0,R}\\,,\\, \\mu\\,\\right)$ under\nM\\\"{o}bius transformations in $\\Md$ that take $z_0$ to $w_0$.\n\nTo carry out this comparison, we need a norm. Any metric $g_{ij}(z)\ndx^i \\otimes dx^j$ induces an inner product on the space of\n2-covariant tensors, as follows: if $\\mathbf{a}(z) = a_{ij}(z)\n\\,dx^i \\otimes dx^j$ and $\\mathbf{b}(z) = b_{ij}(z) \\,dx^i \\otimes\ndx^j$ are two 2-covariant tensors in our parameter space $\\D$, then\ntheir inner product is defined by\n\\begin{equation}\\label{e:inner_product_2-covariant_tensor}\n \\langle \\mathbf{a}(z), \\mathbf{b}(z)\\rangle =\na_{ij}(z)\\,b_{k\\ell}(z)\\,g^{ik}(z)\\,g^{j\\ell}(z)~;\n\\end{equation}\nas always, this inner product defines a norm, $\\|\\mathbf{a}\\|_z^2 =\na_{ij}(z)\\,a_{k\\ell}(z)\\,g^{ik}(z)\\,g^{j\\ell}(z)$.\n\nNow, let us apply this to the computation of the norm of the\ndifference between the local metric on one surface,\n$g_{ij}(z)=\\mu(z)(1-|z|^2)^{-2}\\delta_{ij}$, and\n$h_{ij}(w)=\\nu(w)(1-|w|^2)^{-2}\\delta_{ij}$, the pull-back metric\nfrom the other surface by a M\\\"{o}bius transformation $m$. Using\n(\\ref{e:inner_product_2-covariant_tensor}),(\\ref{e:pullback_of_metric_density_mu_by_mobius}),\nand writing $\\mbox{\\boldmath{$\\delta$}}$ for the tensor with entries $\\delta_{ij}$, we\nhave:\n\\begin{align*}\n\\|\\mu - m^*\\nu\\|_{z}^2 & = \\|\\,\\mu(z) (1-|z|^2)^{-2}\\mbox{\\boldmath{$\\delta$}} -\n\\nu(m(z))\n(1-|z|^2)^{-2} \\mbox{\\boldmath{$\\delta$}}\\,\\|_{z}^2 \\\\\n& = \\Big(\\mu(z) -\n\\nu(m(z))\\Big)^2(1-|z|^2)^{-4}\\,\\delta_{ij}\\,\\delta_{k\\ell}\n\\,g^{ik}(z)\\,g^{j\\ell}(z)=\\left(1 -\n\\frac{\\nu(m(z))}{\\mu(z)}\\right)^2.\n\\end{align*}\n\nWe are now ready to define the distance function\n$d^R_{\\mu,\\nu}(z,w)$:\n\\begin{equation}\\label{e:d_mu,nu(z,w)_def}\n d^R_{\\mu,\\nu}(z_0,w_0) :=\n\\mathop{\\inf}_{m \\in \\Md\\,,\\,m(z_0)=w_0}\\int_{\\Omega_{z_0,R}}\n\\,|\\,\\mu(z) - (m^*\\nu)(z)\\,|\\, d\\vol_H(z),\n\\end{equation}\nwhere $d\\vol_H(z)=(1-|z|^2)^{-2} \\,dx\\wedge dy$ is the volume form\nfor the hyperbolic disk. The integral in (\\ref{e:d_mu,nu(z,w)_def})\ncan also be written in the following form, which makes its\ninvariance more readily apparent:\n\\begin{equation}\\label{e:d_invariant_form}\n \\int_{\\Omega_{z_0,R}}\\left|\\,1 - \\frac{\\nu(m(z))}{\\mu(z)}\\right| \\,d\\vol_\\mathcal{M}(z) = \\int_{\\Omega_{z_0,R}} \\|\\mu - m^*\\nu \\|_z \\, d\\vol_\\mathcal{M}(z),\n\\end{equation}\nwhere $d\\vol_\\mathcal{M}(z)=\\mu(z)(1-|z|^2)^{-2}\\,dx^1\\wedge dx^2\n=\\sqrt{|g_{ij}|}\\,dx^1\\wedge dx^2$ is the volume form of the first\nsurface $\\mathcal{M}$.\n\nThe next Lemma shows that although the integration in\n(\\ref{e:d_invariant_form}) is carried out w.r.t. the volume of the\nfirst surface, this measure of distance is nevertheless symmetric:\n\\begin{lem}\\label{lem:symmetry_of_d_integral}\nIf $m\\in \\Md$ maps $z_0$ to $w_0$, $m(z_0)=w_0$, then\n$$\n\\int_{\\Omega_{z_0,R}}\\Big|\\,\\mu(z) - m^*\\nu(z) \\,\\Big|\\, d\\vol_H(z)\n= \\int_{\\Omega_{w_0,R}}\\Big|\\,m_*\\mu(w) - \\nu(w) \\, \\Big|\\,\nd\\vol_H(w).\n$$\n\\end{lem}\n\\begin{proof}\nBy the pull-back formula\n(\\ref{e:pullback_of_metric_density_mu_by_mobius}), we have\n$$\n\\int_{\\Omega_{z_0,R}}\\Big|\\,\\mu(z) - m^*\\nu(z) \\,\\Big|\\, d\\vol_H(z)\n= \\int_{\\Omega_{z_0}}\\Big|\\,\\mu(z) - \\nu(m(z)) \\,\\Big|\\, d\\vol_H(z).\n$$\nPerforming the change of coordinates $z=m^{-1}(w)$ in the integral\non the right hand side, we obtain\n$$\n\\int_{m(\\Omega_{z_0,R})}\\, \\Big|\\,\\mu(m^{-1}(w)) - \\nu(w) \\Big|\\,\nd\\vol_H(w),\n$$\nwhere we have used that $m^{-1}$ is an isometry and therefore\npreserves the volume element $d\\vol_H(w)=(1-|w|^2)^{-2} \\,dy^1\n\\wedge dy^2$. By Lemma \\ref{lem:m(omega_z)=omega_w},\n$\\,m(\\Omega_{z_0,R})=\\Omega_{w_0,R}\\,$; using the push-forward\nformula (\\ref{e:push_forward_of_metric_density}) then allows to\nconclude.\n\\end{proof}\n\nNote that our point of view in defining our ``distance'' between $z$\nand $w$ differs from the classical point of view in mass\ntransportation: Traditionally, $d(z,w)$ is some sort of\n\\emph{physical distance} between the points $z$ and $w$; in our case\n$d^R_{\\mu,\\nu}(z,w)$ measures the dissimilarity of (neighborhoods\nof) $z$ and $w$.\n\nThe next Theorem lists some important properties of $d^R_{\\mu,\\nu}$;\nits proof is given in Appendix A.\n\\begin{thm}\\label{thm:properties_of_d}\nThe distance function $d^R_{\\mu,\\nu}(z,w)$ satisfies the following\nproperties\n\\begin{table}[ht]\n\\begin{tabular}{c l l}\n{\\rm (1)} & $~d^R_{m^*_1\\mu,m^*_2\\nu}(m^{-1}_1(\\z),m^{-1}_2({w_0})) = d^R_{\\mu,\\nu}(\\z,{w_0})~$ & {\\rm Invariance under (well-defined)}\\\\\n& & {\\rm M\\\"{o}bius changes of coordinates} \\\\\n&&\\\\\n{\\rm (2)} & $~d^R_{\\mu,\\nu}(\\z,{w_0}) = d^R_{\\nu,\\mu}({w_0},\\z)~$ & {\\rm Symmetry} \\\\\n&&\\\\\n{\\rm (3)} & $~d^R_{\\mu,\\nu}(\\z,{w_0}) \\geq 0~$ & {\\rm Non-negativity} \\\\\n&&\\\\\n{\\rm (4)} &\\multicolumn{2}{c}{$\\!\\!\\!\\!\\!\\!d^R_{\\mu,\\nu}(\\z,{w_0}) = 0 \\,\\Longrightarrow \\, \\Omega_{z_0,R}$ {\\rm in} $(\\D,\\mu)$ {\\rm and} $\\Omega_{w_0,R}$ {\\rm in} $(\\D,\\nu)$ {\\rm are isometric} }\\\\\n&&\\\\\n{\\rm (5)} & $~d^R_{m^*\\nu, \\nu}(m^{-1}(\\z),\\z)=0~$ & {\\rm Reflexivity} \\\\\n&&\\\\\n{\\rm (6)} & $~d^R_{\\mu_1,\\mu_3}(z_1,z_3) \\leq\nd^R_{\\mu_1,\\mu_2}(z_1,z_2) + d^R_{\\mu_2,\\mu_3}(z_2,z_3)~$ & {\\rm\nTriangle inequality}\n\\end{tabular}\n\\end{table}\n\n\\end{thm}\n\n\nIn addition, the function\n$d^R_{\\mu,\\nu}:\\D\\times\\D\\,\\rightarrow\\,\\mathbb{R}$ is continuous. To show\nthis, we first look a little more closely at the family of disk\nM\\\"{o}bius transformations that map one pre-assigned point $z_0 \\in\n\\D$ to another pre-assigned point $w_0 \\in \\D$, over which one\nminimizes to define $d_{\\mu}^R(z_0,w_0)$.\n\n\\begin{defn}\\label{def:M_D,z_0,w_0}\nFor any pair of points $z_0,\\,w_0 \\in \\D$, we denote by\n$M_{D,z_0,w_0}$ the set of M\\\"{o}bius transformations that map $z_0$\nto $w_0$.\n\\end{defn}\n\nThis family of M\\\"{o}bius transformations is completely\ncharacterized by the following lemma:\n\n\\begin{lem}\\label{lem:a_and_tet_formula_in_mobius_interpolation}\nFor any $z_0,w_0 \\in \\D$, the set $M_{D,z_0,w_0}$ constitutes a\n$1$-parameter family of disk M\\\"{o}bius transformations,\nparametrized continuously over $S^1$ (the unit circle). More\nprecisely, every $m \\in M_{D,z_0,w_0}$ is of the form\n\\begin{equation}\\label{e:a_of_mobius}\nm(z)= \\tau\\,\\frac{z-a}{1-\\overline{a}z}~,~~\\mbox{ {\\rm{with} }}~~ a\n= a(z_0,w_0,\\sigma) :=\\frac{z_0-w_0\n\\,\\overline{\\sigma}}{1-\\overline{z_0}\\,w_0\\,\\overline{\\sigma}}\n~~~\\mbox{{\\rm and }}~~ \\tau = \\tau(z_0,w_0,\\sigma) := \\sigma\n\\frac{1- \\overline{z_0} \\,w_0 \\,\\overline{\\sigma}}\n{1-z_0\\,\\overline{w_0}\\, \\sigma},\n\\end{equation}\nwhere $\\sigma \\in S_1:=\\{z \\in \\C\\,;\\,|z|=1\\}$ can be chosen freely.\n\\end{lem}\n\\begin{proof}\nBy (\\ref{e:disk_mobius}), the disk M\\\"{o}bius transformations that\nmap $z_0$ to $0$ all have the form\n\\[\nm_{\\psi,z_0}(z)=e^{\\bfi \\psi}\\,\\frac{z-z_0}{1-\\overline{z_0}\\,z}\\,,\n~\\mbox{ the inverse of which is }~~ m_{\\psi,z_0}^{-1}(w)=e^{-\\bfi\n\\psi}\\, \\frac{w+e^{\\bfi \\psi}z_0}{1+ e^{-\\bfi\n\\psi}\\,\\overline{z_0}w}~,\n\\]\nwhere $\\psi \\in \\mathbb{R}$ can be set arbitrarily. It follows that the\nelements of $M_{D,z_0,w_0}$ are given by the family\n$m_{\\gamma,w_0}^{-1}\\circ m_{\\psi,z_0}$, with $\\psi,\\,\\gamma \\in\n\\mathbb{R}$. Working this out, one finds that these combinations of\nM\\\"{o}bius transformations take the form (\\ref{e:a_of_mobius}), with\n$\\sigma=e^{\\bfi (\\psi-\\gamma)}$.\n\\end{proof}\nWe shall denote by $m_{z_0,w_0,\\sigma}$ the special disk M\\\"{obius}\ntransformation defined by (\\ref{e:a_of_mobius}). In view of our\ninterest in $d^R_{\\mu,\\nu}$, we also define the auxiliary function\n\\[\n\\Phi: \\D \\times \\D \\times S_1 \\longrightarrow \\C\n\\]\nby $\\Phi(z_0,w_0,\\sigma) =\n\\int_{\\Omega(z_0,R)}\\,|\\,\\mu(z)-\\nu(m_{z_0,w_0,\\sigma}(z))\\,|\\,d\\vol_H(z)$.\nThis function has the following continuity properties, inherited\nfrom $\\mu$ and $\\nu$:\n\n\\begin{lem}\\label{lem:auxiliary} $~$\\\\\n$\\bullet$ For each fixed $(z_0,w_0)$, the function $\\Phi(z_0,w_0,\\cdot)$ is continuous on $S_1$.\\\\\n$\\bullet$ For each fixed $\\sigma \\in S_1$, $\n\\Phi(\\cdot,\\cdot,\\sigma) $ is continuous on $\\D \\times \\D$.\nMoreover, the family $ \\Big(\\Phi(\\cdot,\\cdot,\\sigma)\\Big)_{\\sigma\n\\in S_1} $ is equicontinuous.\n\\end{lem}\n\\begin{proof}\nThe proof of this Lemma is given in Appendix A.\n\\end{proof}\n\nNote that since $S^1$ is compact, Lemma \\ref{lem:auxiliary} implies\nthat the infimum in the definition of $d^R_{\\mu,\\nu}$ can be\nreplaced by a minimum:\n\\[\nd^R_{\\mu,\\nu}(z_0,w_0)=\\mathop{\\min}_{m(z_0)=w_0}\\,\n\\int_{\\Omega_{z_0,R}}\\,|\\,\\mu(z)-\\nu(m(z))\\,|\\,d\\vol_H(z)~.\n\\]\n\nWe have now all the building blocks to prove\n\\begin{thm}\\label{thm:continuity_of_d^R_mu,nu}\nIf $\\mu$ and $\\nu$ are continuous from $\\D$ to $\\mathbb{R}$, then\n$d^R_{\\mu,\\nu}(z,w)$ is a continuous function on\n$\\D\\times\\D$.\n\\end{thm}\n\\begin{proof}\nPick an arbitrary point $(z_0,w_0) \\in \\D \\times \\D$, and pick\n$\\varepsilon>0$ arbitrarily small.\n\nBy Lemma \\ref{lem:auxiliary}, there exists a $\\delta>0$ such that,\nfor $|z'_0-z_0|<\\delta$, $|w'_0-w_0|<\\delta$, we have\n\\[\n\\left|\\,\\Phi(z_0,w_0,\\sigma)-\\Phi(z'_0,w'_0,\\sigma)\\,\\right|\\,\\leq\\,\n\\varepsilon~,\n\\]\nuniformly in $\\sigma$. Pick now arbitrary $z'_0,w'_0$ so that\n$|z_0-z'_0|,|w_0-w'_0|<\\delta$.\n\nLet $m_{z_0,w_0,\\sigma}$, resp. $m_{z'_0,w'_0,\\sigma'}$, be the\nminimizing M\\\"{o}bius transform in the definition of\n$d_{\\mu,\\nu}^R(z_0,w_0)$, resp. $d_{\\mu,\\nu}^R(z'_0,w'_0)$, i.e.\n\\[\nd^R_{\\mu,\\nu}(z_0,w_0)= \\Phi(z_0,w_0,\\sigma) \\ \\ \\textrm{and} \\ \\\nd^R_{\\mu,\\nu}(z'_0,w'_0)= \\Phi(z_0,w_0,\\sigma')~.\n\\]\n\nIt then follows that\n\\begin{align*}\nd^R_{\\mu,\\nu}(z_0,w_0)&=\\min_{\\tau}\\Phi(z_0,w_0,\\tau)\n\\leq \\Phi(z_0,w_0,\\sigma')\\\\\n&\\leq \\Phi(z'_0,w'_0,\\sigma')+ |\\Phi(z_0,w_0,\\sigma') -\n\\Phi(z'_0,w'_0,\\sigma')|= d^R_{\\mu,\\nu}(z'_0,w'_0)+\n|\\Phi(z_0,w_0,\\sigma') - \\Phi(z'_0,w'_0,\\sigma')|\\\\\n&\\leq d^R_{\\mu,\\nu}(z'_0,w'_0)+ \\mathop{\\sup}_{\\omega \\in\nS_1}|\\Phi(z_0,w_0,\\omega) - \\Phi(z'_0,w'_0,\\omega)| \\leq\nd^R_{\\mu,\\nu}(z'_0,w'_0)+ \\varepsilon~.\n\\end{align*}\nLikewise $d^R_{\\mu,\\nu}(z'_0,w'_0) \\leq d^R_{\\mu,\\nu}(z_0,w_0) +\n\\varepsilon$, so that $\\abs{d^R_{\\mu,\\nu}(z_0,w_0) -\nd^R_{\\mu,\\nu}(z'_0,w'_0)}<\\varepsilon$.\n\\end{proof}\n\n\\subsection{Incorporating $d^R_{\\mu,\\nu}(z,w)$ into the transportation framework}\nThe next step in constructing the distance operator between surfaces\nis to incorporate the distance $d^R_{\\mu,\\nu}(z,w)$ defined in the\nprevious subsection into the (generalized) Kantorovich\ntransportation model:\n\\begin{equation}\nT^R_d(\\mu,\\nu)=\\inf_{\\pi\\in \\Pi(\\mu,\\nu)}\\int_{\\D\\times\n\\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w).\n\\label{e:generalized_Kantorovich_transportation}\n\\end{equation}\nThe main result is that this procedure (under some extra conditions)\nfurnishes a \\emph{metric} between (disk-type) surfaces.\n\n\\begin{thm\nThere exists $\\pi^* \\in \\Pi(\\mu,\\nu)$ such that\n$$\\int_{\\D\\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi^*(z,w)=\\inf_{\\pi\\in \\Pi(\\mu,\\nu)}\\int_{\\D\\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w).$$\n\\end{thm}\n\n\\begin{proof}\nThis proof follows the same argument as in \\cite{Villani:2003},\nadapted here to our generalized setting. It uses the continuity of\nthe distance function to derive the existence of a global minimum of\n(\\ref{e:generalized_Kantorovich_transportation}). Let\n$\\Big(\\pi_k\\Big)_{k\\in \\mathbb{N}} \\in \\Pi(\\mu,\\nu)$ be a minimizer\nsequence of (\\ref{e:generalized_Kantorovich_transportation}), for\nexample by taking\n$$\n\\int_{\\D\\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi_k(z,w) < T^R_d(\\mu,\\nu) +\n\\frac{1}{k}.\n$$\nThen this sequence of measures is tight, that is, for every $\\varepsilon\n>0$, there exists a compact set $C\\subset \\D\\times\\D$ such that\n$\\pi_k(C)>1-\\varepsilon$, for all $k \\in \\mathbb{N}$. To see this, note\nthat since $\\D$ is separable and complete, the measures $\\mu$, $\\nu$\nare \\emph{tight} measures (see \\cite{Billingsley68}). This means\nthat for arbitrary $\\varepsilon >0$, there exist compact sets $A,B \\subset\n\\D$ so that $\\mu(A)>1-\\varepsilon\/2$ and $\\nu(B)>1-\\varepsilon\/2$. It then follows\nthat, for all $k \\in \\mathbb{N}$,\n$$\n\\pi_k(A\\times B) = \\pi_k(A\\times \\D) - \\pi_k(A \\times (\\D \\setminus\nB)\\,) \\geq \\mu(A) - \\nu(\\D\\setminus B) = \\mu(A) - (1 - \\nu(B)) > 1\n- \\varepsilon.\n$$\nSince the set $C = A \\times B \\subset \\D\\times \\D$ is compact, this\nproves the claimed tightness of the family $\\Big(\\pi_k\\Big)_{k\\in\n\\mathbb{N}}$. By Prohorov's Theorem \\cite{Billingsley68}, a tight\nfamily of measures is sequentially weakly compact; in our case this\nmeans that $\\Big(\\pi_k\\Big)_{k\\in \\mathbb{N}}$ has a weakly\nconvergent subsequence $\\Big(\\pi_{k_n}\\Big)_{n\\in \\mathbb{N}}$; by\ndefinition, its weak limit $\\pi^*$ satisfies, for every bounded\ncontinuous function $f$ on $\\D\\times\\D$,\n$$\n\\int_{\\D\\times \\D}f(z,w)d\\pi_{k_n}(z,w) \\rightarrow \\int_{\\D\\times\n\\D}f(z,w)d\\pi^*(z,w).\n$$\nTherefore, taking in particular the continuous function\n$f(z,w)=d^R_{\\mu,\\nu}(z,w)$, we obtain\n$$\nT^R_d(\\mu,\\nu) = \\lim_{n\\rightarrow \\infty} \\int_{\\D\\times\n\\D}f(z,w)d\\pi_{k_n}(z,w) = \\int_{\\D\\times \\D}f(z,w)d\\pi^*(z,w).\n$$\n\n\\end{proof}\n\nUnder rather mild conditions, the ``standard'' Kantorovich\ntransportation (\\ref{e:basic_Kantorovich_transporation}) on a metric\nspaces $(X,d)$ defines a metric on the space of probability\nmeasures on $X$ . We will prove that our generalization defines a\ndistance metric as well. More precisely, we shall prove first that\n$$\n\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=T^R_d(\\mu,\\nu)\n$$\ndefines a semi-metric in the set of all disk-type surfaces. We shall\nrestrict ourselves to surfaces that are sufficiently smooth to allow\nuniformization, so that they can be globally and conformally\nparameterized over the hyperbolic disk. Under some extra\nassumptions, we will prove that $\\mbox{\\bf{d}}^R$ is a metric, in the sense\nthat $\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=0$ implies that $\\mathcal{M}$ and $\\mathcal{N}$ are isometric.\n\nFor the semi-metric part we will again adapt a proof given in\n\\cite{Villani:2003} to our framework. In particular, we shall make\nuse of the following ``gluing lemma'':\n\\begin{lem}\n\\label{lem:gluing_lemma} Let $\\mu_1,\\mu_2,\\mu_3$ be three\nprobability measures on $\\D$, and let $\\pi_{12} \\in\n\\Pi(\\mu_1,\\mu_2)$, $\\pi_{23} \\in \\Pi(\\mu_2,\\mu_3)$ be two\ntransportation plans. Then there exist a probability measure $\\pi$\non $\\D \\times \\D \\times \\D$ that has $\\pi_{12},\\pi_{23}$ as\nmarginals, that is $\\int_{z_3\\in\\D} d\\pi(z_1,z_2,z_3) =\nd\\pi_{12}(z_1,z_2) $, and $\\int_{z_1\\in\\D} d\\pi(z_1,z_2,z_3) =\nd\\pi_{23}(z_2,z_3)$.\n\\end{lem}\nThis lemma will be used in the proof of the following:\n\n\\begin{thm}\nFor two disk-type surfaces $\\mathcal{M}=(\\D,\\mu)$, $\\mathcal{N}=(\\D,\\nu)$, let\n$\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})$ be defined by\n$$\n\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=T^R_d(\\mu,\\nu).\n$$\nThen $\\mbox{\\bf{d}}^R$ defines a semi-metric on the space of disk-type\nsurfaces.\n\\end{thm}\n\\begin{proof}\n\nThe symmetry of $d^R_{\\mu,\\nu}$ implies symmetry for $T^R_d$, by the\nfollowing argument:\n\\begin{align*}\nT^R_d(\\mu,\\nu) &=\n\\mathop{\\inf}_{\\pi \\in \\Pi(\\mu,\\nu)}\\int_{\\D \\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w) = \\mathop{\\inf}_{\\pi \\in \\Pi(\\mu,\\nu)}\\int_{\\D \\times \\D}d^R_{\\nu,\\mu}(w,z)d\\pi(z,w) \\\\\n&=\n\\mathop{\\inf}_{\\pi \\in \\Pi(\\mu,\\nu)}\\int_{\\D \\times \\D}d^R_{\\nu,\\mu}(w,z)d\\widetilde{\\pi}(w,z), ~~~~~~~\\mbox{ where we have set }~\\widetilde{\\pi}(w,z)=\\pi(z,w)\\\\\n&= T^R_d(\\nu,\\mu)~. ~~~~~~~~~(\\mbox{ use that }\\pi\\in\\Pi(\\mu,\\nu)\n\\Leftrightarrow \\widetilde{\\pi}\\in\\Pi(\\nu,\\mu))\n\\end{align*}\n\n\nThe non-negativity of $d^R_{\\mu,\\nu}(\\cdot,\\cdot)$ automatically\nimplies $T^R_d(\\mu,\\nu) \\geq 0$.\n\n\nNext we show that, for any M\\\"{o}bius transformation $m$,\n$T^R_d(\\mu,m_*\\mu)=0$. To see this, pick the transportation plan\n$\\pi \\in \\Pi(\\mu,m_*\\mu)$ defined by\n$$\n\\int_{\\D\\times \\D} f(z,w) d\\pi(z,w) = \\int_{\\D} f(z,m(z))\n\\mu(z)\\,d\\vol_H(z).\n$$\nOn the one hand $\\pi \\in \\Pi(\\mu,m_*\\mu)$, since\n$$\\int_{A \\times \\D} d\\pi(z,w) = \\int_{A} \\mu(z)d\\vol_H(z),$$\nand\n\\begin{align*}\n\\int_{\\D\\times B} d\\pi(z,w) &=\n\\int_{\\D\\times \\D} \\chi_B(w) d\\pi(z,w) \\\\\n&=\\int_{\\D} \\chi_B(m(z)) \\mu(z)d\\vol_H(z) = \\int_{\\D} \\chi_B(w)\n\\mu_*(w)d\\vol_H(w),\n\\end{align*}\nwhere we used the change of variables $w=m(z)$ in the last step.\nFurthermore, $\\pi(z,w)$ is concentrated on the graph of $m$, i.e. on\n$\\set{(z,m(z)) \\ ; \\ z\\in \\D} \\subset \\D \\times \\D$. Since\n$d^R_{\\mu,m_*\\mu}(z,m(z)) = 0$ for all $z \\in \\D$ we obtain\ntherefore $T_d(\\mu,m_*\\mu) \\leq \\int_{\\D\\times \\D}\nd^R_{\\mu,m_*\\mu}(z,w)d\\pi(z,w) = 0$.\n\n\nFinally, we prove the triangle inequality $T^R_d(\\mu_1,\\mu_3) \\leq\nT^R_d(\\mu_1,\\mu_2) + T^R_d(\\mu_2,\\mu_3)$ . To this end we follow the\nargument in the proof given in \\cite{Villani:2003} (page 208). This\nis where we invoke the gluing Lemma stated above.\n\nWe start by picking arbitrary transportation plans $\\pi_{12} \\in\n\\Pi(\\mu_1,\\mu_2)$ and $\\pi_{23} \\in \\Pi(\\mu_2,\\mu_3)$. By Lemma\n\\ref{lem:gluing_lemma} there exists a probability measure $\\pi$ on\n$\\D\\times \\D \\times \\D$ with marginals $\\pi_{12}$ and $\\pi_{23}$.\nDenote by $\\pi_{13}$ its third marginal, that is\n$$\\int_{z_2\\in \\D}d\\pi(z_1,z_2,z_3) = d\\pi_{13}(z_1,z_3).$$\nThen\n\\begin{align*}\nT^R_d(\\mu_1,\\mu_3) &\\leq \\int_{\\D \\times \\D} d^R_{\\mu_1,\\mu_3}(z_1,z_3)d\\pi_{13}(z_1,z_3) = \\int_{\\D \\times \\D \\times \\D} d^R_{\\mu_1,\\mu_3}(z_1,z_3)d\\pi(z_1,z_2,z_3) \\\\\n&\\leq \\int_{\\D \\times \\D \\times \\D} \\Big( d^R_{\\mu_1,\\mu_2}(z_1,z_2) + d^R_{\\mu_2,\\mu_3}(z_2,z_3) \\Big )d\\pi(z_1,z_2,z_3) \\\\\n&\\leq \\int_{\\D \\times \\D \\times \\D} d^R_{\\mu_1,\\mu_2}(z_1,z_2)\nd\\pi(z_1,z_2,z_3) +\n\\int_{\\D \\times \\D \\times \\D} d^R_{\\mu_2,\\mu_3}(z_2,z_3) d\\pi(z_1,z_2,z_3) \\\\\n&\\leq \\int_{\\D \\times \\D } d^R_{\\mu_1,\\mu_2}(z_1,z_2)\nd\\pi_{12}(z_1,z_2) + \\int_{\\D \\times \\D } d^R_{\\mu_2,\\mu_3}(z_2,z_3)\nd\\pi_{23}(z_2,z_3),\n\\end{align*}\nwhere we used the triangle-inequality for $d^R_{\\mu,\\nu}$ listed in\n(Theorem \\ref{thm:properties_of_d}). Since we can choose $\\pi_{12}$\nand $\\pi_{23}$ to achieve arbitrary close values to the infimum in\neq.~(\\ref{e:generalized_Kantorovich_transportation}) the triangle\ninequality follows.\n\\end{proof}\n\nTo qualify as a metric rather than a semi-metric, $\\mbox{\\bf{d}}^R$ (or\n$T^R_d$) should be able to distinguish from each other any two\nsurfaces (or measures) that are not ``identical'', that is\nisometric. To prove that they can do so, we need an extra\nassumption: we shall require that the surfaces we consider have no\nself-isometries. More precisely, we require that each surface $\\mathcal{M}$\nthat we consider satisfies the following definition:\n\n\\begin{defn}\nA surface $\\mathcal{M}$ is said to be a singly\n$\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}\\mbox{fittable}$ (where $\\varrho\n\\in \\mathbb{R},$ $\\varrho \\neq 0$) if, for all $R > \\varrho$, and all\n$z\\in\\D$, there is no other M\\\"{o}bius transformation $m$ other than\nthe identity for which $$\\int_{\\Omega_{z,R}} \\,\n|\\mu(z)-\\mu(m(z))|\\,d\\vol_H(z)=0.$$\n\\end{defn}\n\n\\begin{rem}\nThis definition can also be read as follows: $\\mathcal{M}$ is singly\n$\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}\\mbox{fittable}$ if and only if,\nfor all $R>\\varrho$, any two conformal factors $\\mu_1$ and $\\mu_2$\nfor $\\mathcal{M}$ satisfy:\n\\begin{enumerate}\n\\item\nFor all $z\\in \\D$ there exists a unique minimum to the function $w\n\\mapsto d^R_{\\mu_1,\\mu_2}(z,w)$.\n\\item\nFor all pairs $(z,w)\\in \\D \\times \\D$ that achieve this minimum\nthere exists a unique M\\\"{o}bius transformation for which the\nintegral in {\\rm(\\ref{e:d_mu,nu(z,w)_def})} vanishes (with $\\mu_1$\nin the role of $\\mu$, and $\\mu_2$ in that of $\\nu$).\n\\end{enumerate}\n\\end{rem}\nEssentially, this definition requires that, from some sufficiently\nlarge (hyperbolic) scale onwards, there are no isometric pieces\nwithin $(\\D,\\mu)$ (or $(\\D,\\nu)$).\n\n\n\\begin{figure}[t]\n \n\\hspace*{.3 in}\n\\begin{minipage}{2.8 in}\n \\caption{Illustration of the proof of Theorem \\ref{thm:identity_of_indiscernibles}}\\label{fig:for_proof_identity_of_indiscernibles}\n\\end{minipage}\n\\begin{minipage}{3 in}\n\\hspace*{.7 in}\n\\includegraphics[width=0.8\\columnwidth]{figures\/ingrid_illu.png}\n\\end{minipage}\n\\\n\\end{figure}\n\nWe start with a lemma, and then prove the main result of this\nsubsection.\n\\begin{lem}\\label{lem:in_every_disk_z_w_d(z,w)=0}\nLet $\\pi \\in \\Pi(\\mu,\\nu)$ be such that $\\int_{\\D \\times\n\\D}\\,d^R_{\\mu,\\nu}(z,w)\\,d\\pi(z,w)=0$. Then, for all $z_0 \\in \\D$\nand $\\delta >0$, there exists at least one point $z \\in\n\\Omega_{z_0,\\delta}$ such that $d^R_{\\mu,\\nu}(z,w)=0$ for some $w\n\\in \\D$.\n\\end{lem}\n\\begin{proof}\nBy contradiction: assume that there exists a disk\n$\\Omega_{z_0,\\delta}$ such that $d^R_{\\mu,\\nu}(z,w) >0$ for all\n$z\\in \\Omega_{z_0,\\delta}$ and all $w \\in \\D$. Since\n$$\n\\int_{\\Omega(z_0,\\delta) \\times \\D}\\,d\\pi(z,w) =\n\\int_{\\Omega(z_0,\\delta)}\\mu(z)\\, d\\vol_H(z)>0~,\n$$\nthe set $\\Omega(z_0,\\delta) \\times \\D$ contains some of the support\nof $\\pi$. It follows that\n$$\n\\int_{\\Omega(z_0,\\delta)\\times \\D} d^R_{\\mu,\\nu}(z,w) d\\pi(z,w)>0~,\n$$\nwhich contradicts\n$$\n \\int_{\\Omega(z_0,\\delta) \\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w)\n\\le \\int_{\\D \\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w) = 0~.\n$$\n\\end{proof}\n\\begin{thm}\\label{thm:identity_of_indiscernibles}\nSuppose that $\\mathcal{M}$ and $\\mathcal{N}$ are two surfaces that are singly\n$\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}$fittable. If $\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=0$ for\nsome $R > \\varrho$, then there exists a M\\\"{o}bius transformation $m \\in\n\\Md$ that is a global isometry between $\\mathcal{M}=(\\D,\\mu)$ and\n$\\mathcal{N}=(\\D,\\nu)$ (where $\\mu$ and $\\nu$ are conformal factors of $\\mathcal{M}$\nand $\\mathcal{N}$, respectively).\n\\end{thm}\n\\begin{proof}\nWhen $\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=0$, there exists (see \\cite{Villani:2003}) $\\pi\n\\in \\Pi(\\mu,\\nu)$ such that\n$$\n\\int_{\\D \\times \\D}d^R_{\\mu,\\nu}(z,w)d\\pi(z,w)=0.\n$$\n\nNext, pick an arbitrary point $z_0 \\in \\D$ such that, for some $w_0\n\\in \\D$, we have $d^R_{\\mu,\\nu}(z_0,w_0)=0$. (The existence of such\na pair is guaranteed by Lemma \\ref{lem:in_every_disk_z_w_d(z,w)=0}.)\nThis implies that there exists a unique M\\\"{o}bius transformation\n$m_0 \\in \\Md$ that takes $z_0$ to $w_0$ and that satisfies\n$\\nu(m_0(z))=\\mu(z)$ for all $z \\in \\Omega_{z_0,R}$. We define\n$$\n\\rho^* = \\sup \\{\\rho \\,;\\, d^\\rho_{\\mu,\\nu}(z_0,w_0)=0 \\};\n$$\nclearly $\\rho^* \\geq R$. The theorem will be proved if we show that\n$\\rho^*= \\infty$. We shall do this by contradiction, i.e. we assume\n$\\rho^* < \\infty$, and then derive a contradiction.\n\nSo let's assume $\\rho^* < \\infty$. Consider $\\Omega_{z_0,\\rho^*}$,\nthe hyperbolic disk around $z_0$ of radius $\\rho^*$. (See Figure\n\\ref{fig:for_proof_identity_of_indiscernibles} for illustration.)\nSet $\\varepsilon = (R - \\varrho)\/2$, and consider the points on the\nhyperbolic circle $C=\\partial \\Omega_{z_0, \\rho^*-\\varrho-\\varepsilon}$.\nFor every $z_1 \\in C$, consider the hyperbolic disk\n$\\Omega_{z_1,\\varepsilon\/2}$; by Lemma\n\\ref{lem:in_every_disk_z_w_d(z,w)=0} there exists a point $z_2$ in\nthis disk and a corresponding point $w_2 \\in \\D$ such that\n$d^R_{\\mu,\\nu}(z_2,w_2)=0$, i.e. such that\n\\[\n\\int_{\\Omega_{z_2,R}}\\,|\\mu(z)-m'^*\\nu(z)|^2\\,d\\vol_H(z) \\,=\\,0~\n\\]\nfor some M\\\"{o}bius transformation $m'$ that maps $z_2$ to $w_2$; in\nparticular, we have that\n\\begin{equation}\n\\mu(z)=\\nu(m'(z))~~\\mbox{ for all }~ z \\in \\Omega_{z_2,R}~.\n\\label{e:ingrid:mprime}\n\\end{equation}\nThe hyperbolic distance from $z_2$ to $\\partial \\Omega_{z_0,\\rho^*}$\nis at least $\\varrho+\\varepsilon\/2$.\nIt follows that the hyperbolic disk $\\Omega_{z_2,\\varrho+\\varepsilon\/4}$ is\ncompletely contained in $\\Omega_{z_0,\\rho^*}$; since\n$\\mu(z)=\\nu(m_0(z))$ for all $z \\in \\Omega_{z_0,\\rho^*}$, this must\ntherefore hold, in particular, for all $z \\in\n\\Omega_{z_2,\\varrho+\\varepsilon\/4}$. Since\n$\\Omega_{z_2,\\varrho+\\varepsilon\/4}\\subset \\Omega_{z_2,R}$, we also have\n$\\mu(z)=\\nu(m'(z))$ for all $z \\in \\Omega_{z_2,\\varrho+\\varepsilon\/4}$, by\n(\\ref{e:ingrid:mprime}). This implies $\\nu(w)=\\nu(m_0\\circ\n(m')^{-1}(w))$ for all $w \\in \\Omega_{w_2,\\varrho+\\varepsilon\/4}$. Because\n$\\mathcal{N}$ is singly $\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}$fittable, it\nfollows that $m_0\\circ (m')^{-1}$ must be the identity, or $m_0=\nm'$. Combining this with (\\ref{e:ingrid:mprime}), we have thus shown\nthat $\\mu(z)=\\nu(m_0(z))$ for all $z \\in \\Omega_{z_2,R}$.\n\nSince the distance between $z_2$ and $z_1$ is at most $\\varepsilon\/2$, we\nalso have\n\\begin{equation*}\n\\Omega_{z_2,R} \\supset \\Omega_{z_1,R - \\varepsilon\/2} = \\Omega_{z_1,\\varrho\n+ 3\\varepsilon\/2}~. \\label{e:ingrid:supset}\n\\end{equation*}\n\nThis implies that if we select such a point $z_2(z_1)$ for each\n$z_1\\in C$, then $\\Omega_{z_0, \\rho^* - \\varrho-\\varepsilon}\\cup\n\\left(\\,\\cup_{z_1 \\in C}\\,\\Omega_{z_2(z_1),R}\\right)$ covers the\nopen disk $\\Omega_{z_0,\\rho^*+\\varepsilon\/2}$. By our earlier argument,\n$\\mu(z)=\\nu(m_0(z))$ for all $z$ in each of the\n$\\Omega_{z_2(z_1),R}$; since the same is true on $\\Omega_{z_0,\n\\rho^* - \\varrho-\\varepsilon}$, it follows that $\\mu(z)=\\nu(m_0(z))$ for\nall $z$ in $\\Omega_{z_0,\\rho^*+\\varepsilon\/2}$. This contradicts the\ndefinition of $\\rho^*$ as the supremum of all radii for which this\nwas true; it follows that our initial assumption, that $\\rho^*$ is\nfinite, cannot be true, completing the proof.\n\\end{proof}\n\nFor $(\\D,\\mu)$ to be singly\n$\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}$fittable, no two hyperbolic disks\n$\\Omega_{z,R}$, $\\Omega_{w,R}$ (where $w$ can equal $z$) can be\nisometric via a M\\\"{o}bius transformation $m$, if $R > \\varrho$,\nexcept if $m=Id$. However, if $z$ is close (in the Euclidean sense)\nto the boundary of $\\D$, the hyperbolic disk $\\Omega_{z,R}$ is very\nsmall in the Euclidean sense, and corresponds to a very small piece\n(near the boundary) of $\\mathcal{M}$. This means that single\n$\\varrho\\mbox{-}_{\\mbox{\\tiny{H}}}$fittability imposes restrictions\nin increasingly small scales near the boundary of $\\mathcal{M}$; from a\npractical point of view, this is hard to check, and in many\napplications, the behavior of $\\mathcal{M}$ close to its boundary is\nirrelevant. For this reason, we also formulate the following\nrelaxation of the results above.\n\n\\begin{defn}\nA surface $\\mathcal{M}$ is said to be a singly $A\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable\n(where $A> 0$) if there are no patches (i.e. open, path-connected\nsets) in $\\mathcal{M}$ of area larger than $A$ that are isometric, with\nrespect to the metric on $\\mathcal{M}$.\n\\end{defn}\n\nIf a surface is singly $A\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable, then it is\nobviously also $A'\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable for all $A' \\geq A$;\nthe condition of being $A\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable becomes more\nrestrictive as $A$ decreases. The following theorem states that two\nsingly $A\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable surfaces at zero\n$\\mbox{\\bf{d}}^R$-distance from each other must necessarily be isometric, up to\nsome small boundary layer.\n\n\\begin{thm}\nConsider two surfaces $\\mathcal{M}$ and $\\mathcal{N}$, with corresponding conformal\nfactors $\\mu$ and $\\nu$ on $\\D$, and suppose $\\mbox{\\bf{d}}^R(\\mathcal{M},\\mathcal{N})=0$ for\nsome $R>0$. Then the following holds: for arbitrarily large\n$\\rho>0$, there exist a M\\\"{o}bius transformation $m \\in M_D$ and a value\n$A>0$ such that if $\\mathcal{M}$ and $\\mathcal{N}$ are singly\n$A\\mbox{-}_{\\!_{\\mathcal{M}}}$fittable then $\\mu(m(z))=\\nu(z)$, for all $z\n\\in \\Omega_{0,\\rho}$.\n\\end{thm}\n\\begin{proof}\nPart of the proof follows the same lines as for Theorem\n\\ref{thm:identity_of_indiscernibles}. We highlight here only the new\nelements needed for this proof.\n\nFirst, note that, for arbitrary $r>0$ and $z_0 \\in \\D$,\n\\begin{equation}\\label{e:lower_bound_for_patch_area}\n \\Vol_\\mathcal{M}(\\Omega_{z_0,r}) = \\int_{\\Omega_{z_0,r}}\\mu(z)d\\vol_H(z)\n \\geq \\Vol_H(\\Omega_{z_0,r})\\left[\\min_{z\\in\\Omega_{z_0,r}}\\mu(z)\\right] =\n \\Vol_H(\\Omega_{0,r})\\left[\\min_{z\\in\\Omega_{z_0,r}}\\mu(z)\\right].\n\\end{equation}\nThis motivates the definition of the sets $\\mathcal{O}_{A,r}$,\n\\begin{equation}\\label{e:O_big_area_set}\n \\mathcal{O}_{A,r} = \\set{ z\\in \\D \\ \\mid \\ \\min_{z'\\in\\Omega_{z,r}}\\mu(z') >\n \\frac{A}{\\Vol_H(0,\\Omega_{0,r})}\n };\n\\end{equation}\n$A>0$ is still arbitrary at this point; its value will be set below.\n\nNow pick $rA $.\n\nSince $\\mu$ is bounded below by a strictly positive constant on each\n$\\Omega_{0,\\rho'}$, we can pick, for arbitrarily large $\\rho$, $A>0$\nsuch that $\\Omega_{0,\\rho} \\subset \\mathcal{O}_{A,r}$; for this it suffices\nthat $A$ exceed a threshold depending on $\\rho$ and $r$. (Since\n$\\mu(z)\\rightarrow 0$ as $z$ approaches the boundary of $\\D$ in\nEuclidean norm, we expect this threshold to tend towards $0$ as\n$\\rho \\rightarrow \\infty$.) We assume that $\\Omega_{0,\\rho} \\subset\n\\mathcal{O}_{A,r}$ in what follows.\n\nSimilar to the proof of Theorem\n\\ref{thm:identity_of_indiscernibles}, we invoke Lemma\n\\ref{lem:in_every_disk_z_w_d(z,w)=0} to infer the existence of\n$z_0,w_0$ such that $z_0\\in\\Omega_{0,\\varepsilon\/2}$ and\n$d^R_{\\mu,\\nu}(z_0,w_0)=0$. We denote\n$$\n\\rho^* = \\sup \\{r' \\,;\\, d^{r'}_{\\mu,\\nu}(z_0,w_0)=0 \\};\n$$\nas before, there exists a M\\\"{o}bius transformation $m$ such that\n$\\nu(m(z))=\\mu(z)$ for all $z$ in $\\Omega_{z_0,\\rho^*}$. To complete\nour proof it therefore suffices to show that $\\rho^* \\geq \\rho +\n\\varepsilon\/2$, since $\\Omega_{0,\\rho}\\subset \\Omega_{z_0,\\rho+\\varepsilon\/2}$ .\n\nSuppose the opposite is true, i.e. $\\rho^* < \\rho+\\varepsilon\/2$. By the\nsame arguments as in the proof of Theorem\n\\ref{thm:identity_of_indiscernibles}, there exists, for each\n$z_1\\in \\partial \\Omega_{z_0,\\rho^*-r-\\varepsilon}$, a point $z_2 \\in\n\\Omega_{z_1,\\varepsilon\/2}$ such that $d^R_{\\mu,\\nu}(z_2,w_2)=0$ for some\n$w_2$. Since the hyperbolic distance between $z_2$ and $0$ is\nbounded above by $\\varepsilon\/2+\\rho^*-r-\\varepsilon+\\varepsilon\/2<\\rho-r+\\varepsilon\/2<\\rho$,\n$z_2 \\in \\Omega_{0,\\rho} \\subset \\mathcal{O}_{A,r}$, so that\n$\\Vol_{\\mathcal{M}}(\\Omega_{z_2,R})>A $. It then follows from the conditions\non $\\mathcal{M}$ and $\\mathcal{N}$ that $\\nu(m(z))=\\mu(z)$ for all z in\n$\\Omega_{z_0,\\rho^*} \\cup \\Omega_{z_2,R} \\supset\n\\Omega_{z_0,\\rho^*}\\cup \\Omega_{z_1,r+3\\varepsilon\/2}$. Repeating the\nargument for all $z_1\\in \\partial \\Omega_{z_0,\\rho^*-r-\\varepsilon}$ shows\nthat $\\nu(m(z))=\\mu(z)$ can be extended to all $z \\in\n\\Omega_{z_0,\\rho^*+\\varepsilon\/2}$, leading to a contradiction that\ncompletes the proof.\n\\end{proof}\n\n\n\\section{Discretization and implementation}\n\\label{s:the_discrete_case_implementation} To transform the\ntheoretical framework constructed in the preceding sections into an\nalgorithm, we need to discretize the relevant continuous objects.\nOur general plan is to recast the transportation\neq.~(\\ref{e:generalized_Kantorovich_transportation}) as a linear\nprogramming problem between discrete measures. This requires two approximation steps: \\\\\n1) approximating the surface's Uniformization, and \\\\\n2) discretizing the resulting continuous measures and finding the\noptimal transport between the discrete measures.\n\nTo show how we do this, we first review a few basic notions such as\nthe representation of (approximations to) surfaces by faceted,\npiecewise flat approximations, called {\\em meshes}, and discrete\nconformal mappings; the conventions we describe here are the same as\nadopted in \\cite{Lipman:2009:MVF}.\n\n\\subsection{Meshes, mid-edge meshes, and discrete conformal mapping}\nTriangular (piecewise-linear) meshes are a popular choice for the\ndefinition of discrete versions of smooth surfaces. We shall denote\na triangular mesh by the triple $M = (V, E, F)$, where\n$V=\\{v_i\\}_{i=1}^m \\subset \\mathbb R^3$ is the set of vertices,\n$E=\\{e_{i,j}\\}$ the set of edges, and $F=\\{f_{i,j,k}\\}$ the set\nof faces (oriented $i\\rightarrow j \\rightarrow k$). When dealing\nwith a second surface, we shall denote its mesh by $N$. We assume\nour mesh is homeomorphic to a disk.\n\nNext, we introduce ``conformal mappings'' of a mesh to the unit\ndisk. Natural candidates for discrete conformal mappings are not\nimmediately obvious. Since we are dealing with piecewise linear\nsurfaces, it might seem natural to select a continuous linear maps\nthat is piecewise affine, such that its restriction to each triangle\nis a similarity transformation. A priori, a similarity map from a\ntriangular face to the disk has 4 degrees of freedom; requiring that\nthe image of each edge remain a shared part of the boundary of the\nimages of the faces abutting the edge, and that the map be\ncontinuous when crossing this boundary, imposes 4 constraints for\neach edge. This quick back of the envelope calculation thus allows\n$4|F|$ degrees of freedom for such a construction, with $4|E|$\nconstraints. Since $3|F|\/2 \\approx |E|$ this problem is over\nconstrained, and a construction along these lines is not possible. A\ndifferent approach uses the notion of discrete harmonic and discrete\nconjugate harmonic functions due to Pinkall and Polthier\n\\cite{Pinkall93,Polthier05} to define a discrete conformal mapping\non the mid-edge mesh (to be defined shortly). This relaxes the\nproblem to define a map via a similarity on each triangle that is\ncontinuous through only \\emph{one} point in each edge, namely the\nmid point. This procedure was employed in \\cite{Lipman:2009:MVF}; we\nwill summarize it here; for additional implementation details we\nrefer the interested reader (or programmer) to that paper, which\nincludes a pseudo-code.\n\nThe mid-edge mesh $\\textbf{\\textsf{M}} = (\\textbf{\\textsf{V}}, \\textbf{\\textsf{E}}, \\textbf{\\textsf{F}})$ of a given mesh $M=(V,\nE, F)$ is defined as follows. For the vertices $\\textbf{\\textsf{v}}_r \\in \\textbf{\\textsf{V}}$, we\npick the mid-points of the edges of the mesh $M$; we call these the\nmid-edge points of $M$. There is thus a $\\textbf{\\textsf{v}}_r \\in \\textbf{\\textsf{V}}$\ncorresponding to each edge $e_{i,j} \\in E$. If $\\textbf{\\textsf{v}}_s$ and $\\textbf{\\textsf{v}}_r$\nare the mid-points of edges in $E$ that share a vertex in $M$, then\nthere is an edge $\\textbf{\\textsf{e}}_{s,r} \\in \\textbf{\\textsf{E}}$ that connects them. It follows\nthat for each face $f_{i,j,k} \\in F$ we can define a corresponding\nface $\\mf_{r,s,t} \\in \\textbf{\\textsf{F}}$, the vertices of which are the mid-edge\npoints of (the edges of) $f_{i,j,k}$; this face has the same\norientation as $f_{i,j,k}$. Note that the mid-edge mesh is not a\nmanifold mesh, as illustrated by the mid-edge mesh in Figure\n\\ref{f:discrete_type_1}, shown together with its ``parent'' mesh: in\n$\\textbf{\\textsf{M}}$ each edge ``belongs'' to only one face $\\textbf{\\textsf{F}}$, as opposed to a\nmanifold mesh, in which most edges (the edges on the boundary are\nexceptions) function as a hinge between two faces. This ``lace''\nstructure makes a mid-edge mesh more flexible: it turns out that it\nis possible to define a piecewise linear map that makes each face in\n$\\textbf{\\textsf{F}}$ undergo a pure scaling (i.e. all its edges are shrunk or\nextended by the same factor) and that simultaneously flattens the\nwhole mid-edge mesh. By extending this back to the original mesh, we\nthus obtain a map from each triangular face to a similar triangle in\nthe plane; these individual similarities can be ``knitted together''\nthrough the mid-edge points, which continue to coincide (unlike most\nof the vertices of the original triangles).\n\n\\begin{figure}[ht]\n\\centering \\setlength{\\tabcolsep}{0.4cm}\n\\begin{tabular}{@{\\hspace{0.0cm}}c@{\\hspace{0.2cm}}c@{\\hspace{0.0cm}}}\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_msh.png}\n&\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_me.png} \\\\\nDiscrete mesh& Mid-edge mesh\\\\\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_msh_zoom.png}\n&\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_me_zoom.png} \\\\\nSurface mesh zoom-in & Mid-edge mesh zoom-in\n\\end{tabular}\n\\caption{A mammalian tooth surface mesh, with the corresponding\nmid-edge mesh.}\\label{f:discrete_type_1}\n\\end{figure}\n\nTo determine the flattening map, we use the framework of discrete\nharmonic and conjugate harmonic functions, first defined and studied\nby Pinkall and Polthier \\cite{Pinkall93,Polthier05} in the context\nof discrete minimal surfaces. This framework was first adapted to\nthe present context in \\cite{Lipman:2009:MVF}; this adaptation is\nexplained in some detail in Appendix B. The flattening map is\nwell-defined at the mid-edges $\\textbf{\\textsf{v}}_s$.\nAs shown in \\cite{Lipman:2009:MVF} (see also Appendix B) the\nboundary of the mesh gets mapped onto a region with a straight\nhorizontal slit (see Figure \\ref{f:discrete_type_2}, where the\nboundary points are marked in red). We can assume, without loss of\ngenerality, that this slit coincides with the interval $[-2, 2]\n\\subset \\C$, since it would suffice to shift and scale the whole\nfigure to make this happen. The holomorphic map $z=w+\\frac{1}{w}$\nmaps the unit disk conformally to $\\mathbb{C}\\setminus [-2,2]$, with\nthe boundary of the disk mapped to the slit at $[-2,2]$; when the\ninverse of this map is applied to our flattened mid-edge mesh, its\nimage will thus be a mid-edge mesh in the unit disk, with the\nboundary of the disk corresponding to the boundary of our\n(disk-like) surface. (See Figure \\ref{f:discrete_type_2}.) We shall\ndenote by $\\Phi:\\textbf{\\textsf{V}} \\rightarrow \\C$ the concatenation of these\ndifferent conformal and discrete-conformal maps, from the original\nmid-edge mesh to the corresponding mid-edge mesh in the unit disk.\n\n\\begin{figure}[ht]\n\\centering \\setlength{\\tabcolsep}{0.4cm}\n\\begin{tabular}{@{\\hspace{0.0cm}}c@{\\hspace{0.0cm}}c@{\\hspace{0.0cm}}c@{\\hspace{0.0cm}}}\n\\includegraphics[width=0.2\\columnwidth]{figures\/discrete_slit.png} &\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_slit_zoom.png}\\\\\nMid-edge uniformization & Uniformization Zoom-in \\\\\n\\includegraphics[width=0.4\\columnwidth]{figures\/discrete_disc_uni.png}& \\includegraphics[width=0.5\\columnwidth]{figures\/discrete_conf_factors.png}\\\\\nAfter mapping to the disk & Interpolated conformal factor\n\\end{tabular}\\\\\n\\caption{The discrete conformal transform to the unit disk for the\nsurface of Figure \\ref{f:discrete_type_1}, and the interpolation of\nthe corresponding discrete conformal factors (plotted with the JET\ncolor map in Matlab). The red points in the top row's images show\nthe boundary points of the disk.} \\label{f:discrete_type_2}\n\\end{figure}\n\nNext, we define the Euclidean discrete conformal factors, defined as\nthe density, w.r.t. the Euclidean metric, of the mid-edge triangles\n(faces), i.e.\n\\[\n\\mu^E_{\\mf_{r,s,t}} =\n\\frac{\\vol_{\\mathds{R}^3}(\\mf_{r,s,t})}{\\vol(\\Phi(\\mf_{r,s,t}))}.\n\\]\nNote that according to this definition, we have\n\\[\n\\int_{\\Phi(\\mf_{r,s,t})}\\,\\mu^E_{\\mf_{r,s,t}}\\,d\\vol_E\\, =\n\\,\\frac{\\vol_{\\mathds{R}^3}(\\mf_{r,s,t})}{\\vol_E\\left(\\Phi(\\mf_{r,s,t})\\right)}\\,\n\\vol_E\\left(\\Phi(\\mf_{r,s,t})\\right)\\,=\\,\\vol_{\\mathds{R}^3}(\\mf_{r,s,t}),\n\\]\nwhere $\\vol_E$ denotes the standard Euclidean volume element\n$dx^1\\wedge dx^2$ in $\\C$, and $\\vol_{\\mathbb{R}^3}(\\mf)$ stands for the\narea of $\\mf$ as induced by the standard Euclidean volume element in\n$\\mathbb{R}^3$. The discrete Euclidean conformal factor at a mid-edge vertex\n$\\textbf{\\textsf{v}}_r$ is then defined as the average of the conformal factors for\nthe two faces $\\mf_{r,s,t}$ and $\\mf_{r,s',t'}$ that touch in\n$\\textbf{\\textsf{v}}_r$, i.e.\n\\[\n\\mu^E_{\\textbf{\\textsf{v}}_r} \\,=\\,\n\\frac{1}{2}\\,\\left(\\mu^E_{\\mf_{r,s,t}}\\,+\\,\\mu^E_{\\mf_{r,s',t'}}\\right).\n\\]\nFigure \\ref{f:discrete_type_2} illustrates the values of the\nEuclidean conformal factor for the mammalian tooth surface of\nearlier figures. The discrete hyperbolic conformal factors are\ndefined according to the following equation, consistent with the\nconvention adopted in section \\ref{s:prelim},\n\\begin{equation}\\label{e:discrete_hyperbolic_conformal_density}\n \\mu^H_{\\textbf{\\textsf{v}}_r} \\,= \\,\\mu^E_{\\textbf{\\textsf{v}}_r} \\,\\left(1 - |\\Phi(\\textbf{\\textsf{v}}_r)|^2\\right)^2.\n\\end{equation}\nAs before, we shall often drop the superscript: unless otherwise\nstated, $\\mu=\\mu^H$, and $\\nu=\\nu^H$.\n\nThe (approximately) conformal mapping of the original mesh to the\ndisk is completed by constructing a smooth interpolant $\\Gamma_\\mu\n:\\D \\rightarrow \\mathbb{R}$, which interpolates the discrete conformal\nfactor so far defined only at the vertices in $\\Phi(\\textbf{\\textsf{V}})$;\n$\\Gamma_\\nu$ is constructed in the same way. In practice we use\nThin-Plate Splines, i.e. functions of the type\n\\[\n\\Gamma_\\mu(z) = p_1(z)\\, +\\,\\sum_i\\, b_i \\,\\psi(|z-z_i|)\\,,\n\\]\nwhere $\\psi(r)=r^2\\log(r^2)$, $p_1(z)$ is a linear polynomial in\n$x^1,x^2$, and $b_i \\in \\C$; $p_1$ and the $b_i$ are determined by\nthe data that need to be interpolated. Similarly\n$\\Gamma_\\nu(w)\\,=\\,q_1(w)\\,+\\,\\sum_j \\,c_j\\, \\psi(|w-w_j|)$ for some\nconstants $c_j \\in \\C$ and a linear polynomial $q_1(w)$ in\n$y^1,y^2$. We use as interpolation centers two point sets\n$Z=\\set{z_i}_{i=1}^n,$ and $W=\\set{w_j}_{j=1}^p$ defined in the next\nsubsection for the discretization of measures. See Figure\n\\ref{f:discrete_type_2} (bottom-right) the interpolated conformal\nfactor based on the black point set.\n\nWe also note that for practical purposes it is sometimes\nadvantageous to use Smoothing Thin-Plate Splines:\n$$\\Gamma_\\mu(z) = \\mathop{\\mathrm{argmin}}_{\\gamma} \\set{ \\lambda \\sum_{r} \\abs{\\mu_{\\textbf{\\textsf{v}}_r} - \\gamma(\\Phi(\\textbf{\\textsf{v}}_r))}^2 + (1-\\lambda) \\int_{\\D} \\parr{\\frac{\\partial^2 \\gamma }{\\partial (x^1)^2}}^2 + \\parr{\\frac{\\partial^2 \\gamma }{\\partial x^1 x^2}}^2 + \\parr{\\frac{\\partial^2 \\gamma }{\\partial (x^2)^2}}^2 dx^1 \\wedge dx^2 }.$$\nwhen using these, we picked the value $0.99$ for the smoothing\nfactor $\\lambda$.\n\n\\subsection{Discretizing continuous measures and their transport}\n\\label{ss:discretizing_discrete_measures}\n\nIn this subsection we indicate how to construct discrete\napproximations ${T_{\\mbox{\\footnotesize{discr.}},d}^R}(\\xi,\\zeta)$\nfor the distance $\\mbox{\\bf{d}}^R(\\mathcal{X},\\mathcal{Y})=T^R_d(\\xi,\\zeta)$ between two surfaces\n$\\mathcal{X}$ and $\\mathcal{Y}$, each characterized by a corresponding smooth density\non the unit disk $\\D$ ($\\xi$ for $\\mathcal{X}$, $\\zeta$ for $\\mathcal{Y}$). (In\npractice, we will use the smooth functions $\\Gamma_{\\mu}$ and\n$\\Gamma_{\\nu}$ for $\\xi$ and $\\zeta$. ) We shall use discrete\noptimal transport to construct our approximation\n${T_{\\mbox{\\footnotesize{discr.}},d}^R}(\\xi,\\zeta)$, based on\nsampling sets for the surfaces, with convergence to the continuous\ndistance as the sampling is refined.\n\nTo quantify how fine a sampling set $Z$ is, we use the notion of\n\\emph{fill distance} $\\varphi(Z)$:\n\\[\n\\varphi(Z)\\,:=\\,\\sup \\set{r>0\\ \\big| \\ z \\in \\mathcal{M}:B_g(z,r)\\cap Z_h =\n\\emptyset}~,\n\\]\nwhere $B_g(z,r)$ is the geodesic open ball of radius $r$ centered at\n$z$. That is, $\\varphi(Z)$ is the radius of the largest geodesic\nball that can be fitted on the surface $\\mathcal{X}$ without including any\npoint of $Z$. The smaller $\\varphi(Z)$, the finer the sampling set.\n\nGiven the smooth density $\\xi$ (on $\\D$), we discretize it by first\ndistributing $n$ points $Z=\\{z_i\\}_{i=1}^n$ on $\\mathcal{X}$ with\n$\\varphi(Z)=h>0$. For $i=1,\\ldots,n$, we define the sets $\\Xi_i$ to\nbe the Voronoi cells corresponding to $z_i \\in Z$; this gives a\npartition of the surface $\\mathcal{X}$ into disjoint convex sets,\n$\\mathcal{X}=\\cup_{i=1}^n \\Xi_i$. We next define the discrete measure $\\xi_Z$\nas a superposition of point measures localized in the points of $Z$,\nwith weights given by the areas of $\\Xi_i$, i.e. $\\xi_Z\n\\,=\\,\\sum_{i=1}^n\\,\\xi_i \\delta_{z_i}$, with\n$\\xi_i:=\\xi(\\Xi_i)=\\int_{\\Xi_i}d\\vol_\\mathcal{X}$. Similarly we denote by\n$W=\\{w_j\\}_{j=1}^p$, $\\Upsilon_j$, and $\\zeta_j:=\\zeta(\\Upsilon_j)$\nthe corresponding quantities for surface $\\mathcal{Y}$. We shall always\nassume that the surfaces $\\mathcal{X}$ and $\\mathcal{Y}$ have the same area, which,\nfor convenience, we can take to be 1. It then follows that the\ndiscrete measures $\\xi_Z$ and $\\zeta_W$ have equal total mass\n(regardless of whether $n=p$ or not). The approximation algorithm\nwill compute optimal transport for the discrete measures $\\xi_Z$ and\n$\\zeta_W$; the corresponding discrete approximation to the distance\nbetween $\\xi$ and $\\zeta$ is then given by $T^R_d(\\xi_Z,\\zeta_W)$.\n\nConvergence of the discrete approximations $T^R_d(\\xi_Z,\\zeta_W)$ to\n$T^R_d(\\xi,\\zeta)=\\mbox{\\bf{d}}^R(\\mathcal{X},\\mathcal{Y})$ as $\\varphi(Z)$, $\\varphi(W) \\rightarrow 0$\nthen follows from the results proved in\n\\cite{Lipman:TR2009:approxOptimal}. Corollary 3.3 in\n\\cite{Lipman:TR2009:approxOptimal} requires that the distance\nfunction $d^R_{\\xi,\\zeta}(\\cdot,\\cdot)$ used to define\n$T^R_d(\\xi,\\zeta)$ be uniformly continuous in its two arguments. We\ncan establish this in our present case by invoking the continuity\nproperties of $d^R_{\\xi,\\zeta}$ proved in Theorem\n\\ref{thm:continuity_of_d^R_mu,nu}, extended by the following lemma,\nproved in Appendix A.\n\\begin{lem}\\label{lem:extension_of_d}\nLet $\\set{(z_k,w_k)}_{k\\geq 1} \\subset \\D\\times\\D$ be a sequence\nthat converges, in the Euclidean norm, to some point in $(z',w') \\in\n\\bbar{\\D}\\times\\bbar{\\D} \\setminus \\D\\times\\D$, that is\n$|z_k-z'|+|w_k-w'| \\rightarrow 0$, as $k \\rightarrow \\infty$. Then, $\\lim_{k\\rightarrow\n\\infty}d^R_{\\xi,\\zeta}(z_k,w_k)$ exists and depends only on the\nlimit point $(z',w')$.\n\\end{lem}\n\nWe shall denote this continuous extension of\n$d^R_{\\mu,\\nu}(\\cdot,\\cdot)$ to $\\bbar{\\D}\\times \\bbar{\\D}$ by the\nsame symbol $d^R_{\\mu,\\nu}$.\n\nSince $\\bbar{\\D} \\times \\bbar{D}$ is compact, (this extension of)\n$d^R_{\\xi,\\zeta}(\\cdot,\\cdot)$ is uniformly continuous: for all\n$\\varepsilon >0$, there exists a $\\delta=\\delta(\\varepsilon)$ such that, for all\n$z,z' \\in \\mathcal{X}$, $w,w' \\in \\mathcal{Y}$,\n\\[\nd_\\mathcal{X}(z,z') < \\delta(\\varepsilon) \\ , d_\\mathcal{Y}(w,w') < \\delta(\\varepsilon) \\\n\\Rightarrow \\ \\abs{d^R_{\\xi,\\zeta}(z,w) - d^R_{\\xi,\\zeta}(z',w') } <\n\\varepsilon,\n\\]\nwhere $d_\\mathcal{X}(\\cdot,\\cdot)$ is the geodesic distance on $\\mathcal{X}$, and\n$d_\\mathcal{Y}(\\cdot,\\cdot)$ is the geodesic distance on $\\mathcal{Y}$.\n\nThe results in \\cite{Lipman:TR2009:approxOptimal} then imply that\n$\\xi_Z \\rightarrow \\xi$ in the \\emph{weak} sense, as $\\varphi(Z) \\rightarrow 0$,\ni.e. that for all bounded continuous functions $f:\\bbar{\\D}\\rightarrow\n\\mathbb R$, the convergence $\\int_\\D f\\ d\\xi_Z \\rightarrow \\int_\\D f\\ d\\xi$\nholds \\cite{Billingsley68}. Similarly and $\\zeta_W \\rightarrow \\zeta$ in\nthe weak sense as $\\varphi(W) \\rightarrow 0$. Furthermore,\n\\cite{Lipman:TR2009:approxOptimal} also proves that for\n$\\max(\\varphi(Z),\\varphi(W)) < \\frac{\\delta(\\varepsilon)}{2}$\n\\[\n\\abs{T^R_d(\\xi_Z,\\zeta_W) - T^R_d(\\xi,\\zeta)} < \\varepsilon.\n\\]\nMore generally, it is shown that\n\\begin{equation}\\label{e:optimal_trans_discrete_approx_with_mod_cont}\n \\abs{T^R_d(\\xi_Z,\\zeta_W) - T^R_d(\\xi,\\zeta)} <\n\\omega_{d^R_{\\xi,\\zeta}}\\parr{\\max(\\varphi(Z),\\varphi(W))},\n\\end{equation}\nwhere $\\omega_{d^R_{\\xi,\\zeta}}$ is the modulus of continuity of\n$d^R_{\\xi,\\zeta}$, that is\n$$\\omega_{d^R_{\\xi,\\zeta}}(t)=\\sup_{d_\\mathcal{X}(z,z') + d_\\mathcal{Y}(w,w') <\nt}\\abs{d^R_{\\xi,\\zeta}(z,w)-d^R_{\\xi,\\zeta}(z',w')}.$$\n\nWe shall see below that it will be particularly useful to choose the\ncenters in $Z=\\set{z_i}_{i=1}^n$, $W=\\set{w_j}_{j=1}^p$ such that\nthe corresponding Voronoi cells are (approximately) of equal area,\ni.e. $n=N=p$ and $\\xi_i=\\xi(\\Xi_i)\\approx\\frac{1}{N}$,\n$\\zeta_j=\\zeta(\\Upsilon_j)\\approx\\frac{1}{N}$, where we have used\nthat the total area of each surface is normalized to $1$. An\neffective way to calculate such sample sets $Z$ and $W$ is to start\nfrom an initial random seed (which will not be included in the set),\nand take the geodesic point furthest from the seed as the initial\npoint of the sample set. One then keeps repeating this procedure,\nselecting at each iteration the point that lies at the furthest\ngeodesic distance from the set of points already selected. This\nalgorithm is known as the Farthest Point Algorithm (FPS)\n\\cite{eldar97farthest}. An example of the output of this algorithm,\nusing geodesic distances on a disk-type surface, is shown in Figure\n\\ref{f:discrete_type_3}. Further discussion of practical aspects of\nVoronoi sampling of a surface can be found in\n\\cite{BBK2007non_rigid_book}.\n\n\\begin{figure}[h]\n\\centering \\setlength{\\tabcolsep}{0.4cm} \\hspace*{.5 in}\n\\begin{minipage}{3 in}\n\\includegraphics[width=0.8\\columnwidth]{figures\/discrete_sam_points.png}\\hspace*{-.5 in}\n\\end{minipage}\n\\hspace*{-.5 in}\n\\begin{minipage}{3 in}\n\\caption{Sampling of the surface of Figure \\ref{f:discrete_type_1}\nobtained by the Farthest Point Algorithm.}\n\\label{f:discrete_type_3}\n\\end{minipage}\n\\end{figure}\n\n\n\\subsection{Approximating the local distance function $d^R_{\\mu,\\nu}$.}\nWe are now ready to construct our discrete version of the optimal\nvolume transportation for surfaces\n(\\ref{e:generalized_Kantorovich_transportation}). The previous\nsubsection describes how to derive the discrete measures\n$\\mu_Z,\\nu_W$ from the approximate conformal densities\n$\\Gamma_\\mu,\\Gamma_\\nu$ and the sampling sets $Z$ and $W$. For\nsimplicity, we will, with some abuse of notation, identify the\napproximations $\\Gamma_\\mu,\\Gamma_\\nu$ with $\\mu,\\nu$. The\napproximation error made here is typically much smaller than the\nerrors made in further steps (see below) and we shall neglect it.\nThe final component is approximating $d^R_{\\mu,\\nu}(z_i,w_j)$ for\nall pairs $(z_i,w_j) \\in Z\\times W$. Applying\n(\\ref{e:d_mu,nu(z,w)_def}) to the points $z_i$, $w_j$ we have:\n\\begin{equation}\\label{e:d_mu,nu(z_i,w_j)}\n d^R_{\\mu,\\nu}(z_i,w_j) = \\min_{m(z_i)=w_j}\\int_{\\Omega_{z_i, R}}\\Big|\\,\\mu(z)-\\nu(m(z))\\,\\Big |\\,d\\vol_H.\n\\end{equation}\n\n\\begin{figure}\n \n \\includegraphics[width=0.7\\columnwidth]{figures\/int_rules_100_300.png}\\\\\n \\caption{The integration centers and their corresponding Voronoi cells used\nfor calculating the integration weights for the discrete quadrature.\nLeft: $100$ centers; Right: $300$.}\\label{fig:integration_pnts}\n\\end{figure}\n\nTo obtain $d^R_{\\mu,\\nu}(z_i,w_j)$ we will thus need to compute\nintegrals over hyperbolic disks of radius $R$, which is done via a\nseparate approximation procedure, set up once and for all in a\npreprocessing step at the start of the algorithm.\n\nBy using a M\\\"{o}bius transformation $\\widetilde{m}$ such that\n$\\widetilde{m}(0)=z_0$, and the identity\n\\[\n\\int_{\\Omega_{0,R}}\\Big|\\,\\mu(\\widetilde{m}(u)) - \\nu(m \\circ\n\\widetilde{m} (u))\\,\\Big| \\,d\\vol_H(u) =\n\\int_{\\Omega_{z_0,R}}\\Big|\\,\\mu(z)) - \\nu(m (z))\\,\\Big|\n\\,d\\vol_H(z)~,\n\\]\nwe can reduce the integrals over the hyperbolic disks\n$\\Omega_{z_i,R}$ to integrals over a hyperbolic disk centered around\nzero.\n\nIn order to (approximately) compute integrals over $\\Omega_0\n=\\Omega_{0,R}=\\{z |\\ |z|\\leq r_R\\}$, we first pick a positive\ninteger $K$ and distribute centers $p_k,\\,k=1,...,K $ in $\\Omega_0$.\nWe then decompose $\\Omega_0$ into Voronoi cells $\\Delta_k$\ncorresponding to the $p_k$, obtaining $\\Omega_0 = \\cup_{k=1}^K\n\\Delta_k$; see Figure \\ref{fig:integration_pnts} (note that these\nVoronoi cells are completely independent of those used in\n\\ref{ss:discretizing_discrete_measures}.)\n\nTo approximate the integral of a continuous function $f$ over\n$\\Omega_0$ we then use\n\\[\n\\int_{\\Omega_0}\\, f(z)\\, d\\vol_H(z) \\approx \\sum_k \\,\n\\brac{\\int_{\\Delta_k}d\\vol_H(z)}\\,f(p_k) = \\sum_k \\,\\alpha_k f(p_k)\n\\]\nwhere $\\alpha_k = \\int_{\\Delta_k}d\\vol_H(z)$.\n\nWe thus have the following approximation:\n\\begin{eqnarray}\nd^R_{\\mu,\\nu}(z_i,w_j)&=&\n\\min_{m(z_i)=w_j}\\int_{\\Omega_{z_i,R}}\\Big|\\,\\mu(z) - \\nu(m\n(z))\\,\\Big|\n\\,d\\vol_H(z)\\nonumber\\\\\n&=& \\min_{m(z_i)=w_j}\\int_{\\Omega_{0,R}}\\Big|\\,\\mu(\\widetilde{m}_i\n(z)) -\n\\nu(m(\\widetilde{m}_i (z)))\\,\\Big|\\,d\\vol_H(z)\\nonumber\\\\\n&\\approx& \\min_{m(z_i)=w_j} \\sum_k \\,\\alpha_k\n\\,\\Big|\\,\\mu(\\widetilde{m}_i (p_k)) - \\nu(m(\\widetilde{m}_i\n(p_k)))\\,\\Big|~,\\label{e:discrete_approx__d_mu_nu(z_i,w_j)}\n\\end{eqnarray}\nwhere the M\\\"{o}bius transformations $\\widetilde{m}_i$, mapping 0 to\n$z_i$, are selected as soon as the $z_i$ themselves have been\npicked, and remain the same throughout the remainder of the\nalgorithm.\n\nIt can be shown that picking a set of centers $\\set{p_k}$ with\nfill-distance $h>0$ leads to an $O(h)$ approximation; in\nAppendix~\\ref{a:appendix A} we prove:\n\\begin{thm}\\label{thm:convergence_of_numerical_quadrature}\nFor continuously differentiable $\\mu,\\nu$,\n\\[\n\\left|\\,d^R_{\\mu,\\nu}(z_i,w_j)- \\min_{m(z_i)=w_j}\\sum_k \\,\\alpha_k\n\\,\\left|\\,\\mu(\\widetilde{m}_i (p_k)) - \\nu(m(\\widetilde{m}_i\n(p_k)))\\,\\right|\\, \\right| \\leq C\\,\\varphi\\left( \\set{p_k} \\right)~,\n\\]\nwhere the constant $C$ depends only on $\\mu,\\nu,R$.\n\\end{thm}\n\nLet us denote this approximation by $$\\wh{d}^R_{\\mu,\\nu}(z_i,w_j) =\n\\min_{m(z_i)=w_j}\\sum_k \\,\\alpha_k \\,\\left|\\,\\mu(\\widetilde{m}_i\n(p_k)) - \\nu(m(\\widetilde{m}_i (p_k)))\\,\\right|.$$ Since the above\ntheorem guarantees that the approximation error\n$\\abs{\\wh{d}^R_{\\mu,\\nu}(z_i,w_j) - d^R_{\\mu,\\nu}(z_i,w_j)}$ can be\nuniformly bounded independently of $z_i,w_j$, it can be shown that\n$$\\babs{T^R_d(\\mu_Z,\\nu_W) - T^R_{\\wh{d}}(\\mu_Z,\\nu_W)}\n\\leq C \\varphi \\parr{\\set{p_k}},$$ where again $C$ is dependent only\nupon $\\mu,\\nu,R$. Combining this with\neq.(\\ref{e:optimal_trans_discrete_approx_with_mod_cont}) we get that\n\\begin{equation}\\label{e:final_approx_error}\n \\babs{T^R_d(\\mu,\\nu) - T^R_{\\wh{d}}(\\mu_Z,\\nu_W)}\n\\leq \\omega_{d^R_{\\mu,\\nu}}\\parr{\\max \\parr{\\varphi(Z),\\varphi(W)}}\n+ C\\varphi \\parr{\\set{p_k}}.\n\\end{equation}\n\nIn practice, for calculating $\\wh{d}^R_{\\mu,\\nu}$, the minimization\nover $M_{D,z_i,w_j}$, the set of all M\\\"{o}bius transformations that map\n$z_i$ to $w_k$, is discretized as well: instead of minimizing over\nall $m_{z_i,w_j,\\sigma}$ (see subsection 3.1), we minimize over only\nthe M\\\"{o}bius transformations\n$\\left(m_{z_i,w_j,2\\pi\\ell\/L}\\right)_{\\ell=0,1,..,L-1}$. Taking this\ninto account as well, we have thus\n\\begin{eqnarray}\nd^R_{\\mu,\\nu}(z_i,w_j)\\approx \\min_{\\ell=1,\\ldots L} \\sum_k\n\\,\\alpha_k \\,\\Big|\\,\\mu(\\widetilde{m}_i (p_k)) - \\nu(m_{z_i,w_j,2\\pi\n\\ell\/L}(\\widetilde{m}_i\n(p_k)))\\,\\Big|~;\\label{e:discrete_approx__d_mu_nu(z_i,w_j)_bis}\n\\end{eqnarray}\nthe error made in approximation\n(\\ref{e:discrete_approx__d_mu_nu(z_i,w_j)_bis}) is therefore\nproportional to $L^{-1}+C\\varphi\\left( \\set{p_k} \\right)$.\n\n\nTo summarize, our approximation $T^R_{\\wh{d}}(\\mu_Z,\\nu_W)$ to the\nuniformly continuous $T^R_d(\\mu,\\nu)$ is based on two\napproximations: on the one hand, we compute the transportation cost\nbetween the discrete measures $\\mu_Z,\\nu_W$, approximating\n$\\mu,\\nu$; on the other hand, this transportation cost involves a\nlocal distance $\\wh{d}^R_{\\mu,\\nu}$ which is itself an\napproximation.\nThe transportation between the discrete measures will be computed by\nsolving a linear programming optimization, as explained in detail in\nthe next subsection.\nThe final approximation error (\\ref{e:final_approx_error}) depends\non two factors: 1) the fill distances $\\varphi(Z),\\varphi(W)$ of the\nsample sets $Z,W$, and 2) the approximation of the local distance\nfunction $d^R_{\\mu,\\nu}(z_i,w_j)$ between the sample points.\nCombining the discretization of the M\\\"{o}bius search with\n(\\ref{e:discrete_approx__d_mu_nu(z_i,w_j)_bis}), the total\napproximation error is thus proportional to\n$\\omega_{d^R_{\\Gamma_\\mu,\\Gamma_\\nu}}\\parr{\\varphi\\left( \\set{p_k}\n\\right)} + L^{-1} + \\varphi\\left( \\set{p_k} \\right)$.\n\nRecall that we are in fact using $\\Gamma_\\mu,\\Gamma_\\nu$ in the role\nof of $\\mu,\\nu$ (see above), which entails an additional\napproximation error. This error relates to the accuracy with which\ndiscrete meshes approximate smooth manifolds, as well as the method\nused to approximate uniformization. We come back to this question in\nAppendix B. As far as we are aware, a full convergence result for\n(any) discrete uniformization is still unknown; in any case, we\nexpect this error to be negligible (and approximately of the order\nof the largest edge in the full mesh) compared to the others.\n\n\n\\subsection{Optimization via linear programming}\n\nThe discrete formulation of\neq.~(\\ref{e:generalized_Kantorovich_transportation}) is commonly\nformulated as follows:\n\\begin{equation}\\label{e:discrete_kantorovich}\n \\sum_{i,j}d_{ij}\\pi_{ij} \\rightarrow \\min\n\\end{equation}\n\\begin{equation}\\label{e:discrete_kantorovich_CONSTRAINTS}\n\\begin{array}{l}\n \\left \\{\n \\begin{array}{l}\n \\sum_i \\pi_{ij} = \\nu_j \\\\\n \\sum_j \\pi_{ij} = \\mu_i \\\\\n \\pi_{ij} \\geq 0\n \\end{array}\n \\right . ,\n \n\\end{array}\n\\end{equation}\nwhere $\\mu_i=\\mu(\\Xi_i)$ and $\\nu_j=\\nu(\\Upsilon_j)$, and $d_{ij} =\nd^R_{\\mu,\\nu}(z_i,w_j)$.\n\nIn practice, surfaces are often only partially isometric (with a\nlarge overlapping part), or the sampled points may not have a good\none-to-one and onto correspondence (i.e. there are points both in\n$Z$ and in $W$ that do not correspond well to any point in the other\nset). In these cases it is desirable to allow the algorithm to\nconsider transportation plans $\\pi$ with marginals \\emph{smaller or\nequal} to $\\mu$ and $\\nu$. Intuitively this means that we allow that\nonly some fraction of the mass is transported and that the remainder\ncan be ``thrown away''. This leads to the following formulation:\n\\begin{equation}\\label{e:discrete_PARTIAL_kantorovich}\n\\sum_{i,j}d_{ij}\\pi_{ij} \\rightarrow \\min\n\\end{equation}\n\\begin{equation}\\label{e:discrete_PARTIAL_kantorovich_CONSTRAINTS}\n\\begin{array}{l}\n \\left \\{ \\begin{array}{c}\n \\sum_i \\pi_{ij} \\leq \\nu_j \\\\\n \\sum_j \\pi_{ij} \\leq \\mu_i \\\\\n \\sum_{i,j} \\pi_{ij} = Q \\\\\n \\pi_{ij} \\geq 0\n \\end{array}\n \\right .\n\\end{array}\n\\end{equation}\nwhere $0 < Q \\leq 1$ is a parameter set by the user that indicates\nhow much mass \\emph{must} be transported, in total.\n\nThe corresponding transportation distance is defined by\n\\begin{equation}\\label{e:discrete_trans_dist}\n T_d(\\nu,\\nu) = \\sum_{ij}d_{ij}\\pi_{ij},\n\\end{equation}\nwhere $\\pi_{ij}$ are the entries in the matrix $\\pi$ for the optimal\n(discrete) transportation plan.\n\nSince these equations and constraints are all linear, we have the\nfollowing theorem:\n\\begin{thm}\nThe equations {\\rm\n(\\ref{e:discrete_kantorovich})-(\\ref{e:discrete_kantorovich_CONSTRAINTS})}\nand {\\rm (\\ref{e:discrete_PARTIAL_kantorovich})-\n(\\ref{e:discrete_PARTIAL_kantorovich_CONSTRAINTS})} admit a global\nminimizer that can be computed in polynomial time, using standard\nlinear-programming techniques.\n\\end{thm}\n\nWhen correspondences between surfaces are sought, i.e. when one\nimagines one surface as being transformed into the other, one is\ninterested in restricting $\\pi$ to the class of permutation matrices\ninstead of allowing all bistochastic matrices. (This means that each\nentry $\\pi_{ij}$ is either 0 or 1.) In this case the number of\ncenters $z_i$ must equal that of $w_j$, i.e. $n=N=p$, and it is best\nto pick the centers so that $\\mu_i=\\frac{1}{N}=\\nu_j$, for all $i,\\\nj$. It turns out that this is sufficient to {\\em guarantee} (without\nrestricting the choice of $\\pi$ in any way) that the minimizing\n$\\pi$ is a permutation:\n\n\\begin{thm}\nIf $n=N=p$ and $\\mu_i=\\frac{1}{N}=\\nu_j$, then\n\\begin{enumerate}\n\\item\nThere exists a global minimizer of\n{\\rm(\\ref{e:discrete_kantorovich})} that is a permutation matrix.\n\\item\nIf furthermore $Q = \\frac{M}{N}$, where $M< N$ is an integer, then\nthere exists a global minimizer of {\\rm\n(\\ref{e:discrete_PARTIAL_kantorovich})} $\\pi$ such that $\\pi_{ij}\n\\in \\{0,1\\}$ for each $i,\\,j$.\n\\end{enumerate}\n\\label{t:relaxation}\n\\end{thm}\n\\begin{rem}\nIn the second case, where $\\pi_{ij} \\in \\{0,1\\}$ for each $i,\\,j$\nand $\\sum_{i,j=1}^N \\pi_{ij}=M$, $\\pi$ can still be viewed as a\npermutation of $M$ objects, ``filled up with zeros''. That is, if\nthe zero rows and columns of $\\pi$ (which must exist, by the pigeon\nhole principle) are removed, then the remaining $M \\times M$ matrix\nis a permutation.\n\\end{rem}\n\\begin{proof}\nWe first note that in both cases, we can simply renormalize each\n$\\mu_i$ and $\\nu_j$ by $N$, leading to the rescaled systems\n\\begin{equation}\n \\left \\{ \\begin{array}{c}\n \\sum_i \\pi_{ij} = 1 \\\\\n \\sum_j \\pi_{ij} = 1 \\\\\n \\pi_{ij} \\geq 0\n \\end{array}\n \\right . \\mbox{\\hspace{1 in}}\n \\left \\{\\begin{array}{c}\n \\sum_i \\pi_{ij} \\leq 1 \\\\\n \\sum_j \\pi_{ij} \\leq 1 \\\\\n \\sum_{i,j} \\pi_{ij} = M \\\\\n \\pi_{ij} \\geq 0\n\\end{array}\n \\right .\n\\label{e:discrete_kantorovich_CONSTRAINTS_disk}\n\\end{equation}\nTo prove the first part, we note that the left system in\n(\\ref{e:discrete_kantorovich_CONSTRAINTS_disk}) defines a convex\npolytope in the vector space of matrices that is exactly the\nBirkhoff polytope of bistochastic matrices. By the Birkhoff-Von\nNeumann Theorem \\cite{Lovasz86} every bistochastic matrix is a\nconvex combination of the permutation matrices, i.e. each $\\pi$\nsatisfying the left system in\n(\\ref{e:discrete_kantorovich_CONSTRAINTS_disk}) must be of the form\n$\\sum_k c_k\\tau^k$, where the $\\tau^k$ are the $N!$ permutation\nmatrices for $N$ objects, and $\\sum_k c_k = 1$, with $c_k \\geq 0$.\nThe minimizing $\\pi$ in this polytope for the linear functional\n(\\ref{e:discrete_kantorovich}) must thus be of this form as well. It\nfollows that at least one $\\tau^k$ must also minimize\n(\\ref{e:discrete_kantorovich}), since otherwise we would obtain the\ncontradiction\n\\begin{equation}\\label{e:linear_extrermas_at_vertices}\n \\sum_{ij}d_{ij}\\pi_{ij} = \\sum_k c_k \\Big (\\sum_{ij}d_{ij} \\tau^k_{ij} \\Big ) \\geq \\min_k \\Big \\{ \\sum_{ij}d_{ij} \\tau^k_{ij} \\Big \\} > \\sum_{i,j}\\,d_{ij}\\,\\pi_{ij} ~.\n\\end{equation}\n\nThe second part can be proved along similar steps: the right system\nin (\\ref{e:discrete_kantorovich_CONSTRAINTS_disk}) defines a convex\npolytope in the vector space of matrices; it follows that every\nmatrix that satisfies the system of constraints is a convex\ncombination of the extremal points of this polytope. It suffices to\nprove that these extreme points are exactly those matrices that\nsatisfy the constraints and have entries that are either 0 or 1\n(this is the analog of the Birkhoff-von Neumann theorem for this\ncase; we prove this generalization in a lemma in Appendix C); the\nsame argument as above then shows that there must be at least one\nextremal point where the linear functional\n(\\ref{e:discrete_kantorovich}) attains its minimum.\n\\end{proof}\n\nThis means that, when we seek correspondences between two surfaces,\nthere is no need to {\\em impose} the (very nonlinear) constraint on\n$\\pi$ that it be a permutation matrix; one can simply use a linear\nprogram to solve either , with Theorem \\ref{t:relaxation}\nguaranteeing that the minimizer for the ``relaxed'' problem {\\rm\n(\\ref{e:discrete_kantorovich})-(\\ref{e:discrete_kantorovich_CONSTRAINTS})}\nor {\\rm (\\ref{e:discrete_PARTIAL_kantorovich})-\n(\\ref{e:discrete_PARTIAL_kantorovich_CONSTRAINTS})} is of the\ndesired type if $n=N=p$ and $\\mu_i=\\frac{1}{N}=\\nu_j$.\n\n\\subsection{Consistency}\nIn our schemes to compute the surface transportation distance, for\nexample by solving (\\ref{e:discrete_PARTIAL_kantorovich}), we have\nso far not included any constraints on the regularity of the\nresulting optimal transportation plan $\\pi^*$. When computing the\ndistance between a surface and a reasonable deformation of the same\nsurface, one does indeed find, in practice, that the minimizing\n$\\pi^*$ is fairly smooth, because neighboring points have similar\nneighborhoods. There is no guarantee, however, that this has to\nhappen. Moreover, we will be interested in comparing surfaces that\nare far from (almost) isometric, given by noisy datasets. Under such\ncircumstances, the minimizing $\\pi^*$ may well ``jump around''. In\nthis subsection we propose a regularization procedure to avoid such\nbehavior.\n\nComputing how two surfaces best correspond makes use of the values\nof the ``distances in similarity'' $d^R_{\\mu,\\nu}(z_i,w_j)$ between\npairs of points that ``start'' on one surface and ``end'' on the\nother; computing these values relies on finding a minimizing M\\\"{o}bius \ntransformation for the functional (\\ref{e:d_mu,nu(z,w)_def}). We can\nkeep track of these minimizing M\\\"{o}bius transformations $m_{ij}$ for the\npairs of points $(z_i,w_j)$ proposed for optimal correspondence by\nthe optimal transport algorithm described above. Correspondence\npairs $(i,j)$ that truly participate in some close-to-isometry map\nwill typically have M\\\"{o}bius transformations $m_{ij}$ that are very\nsimilar. This suggests a method of filtering out possibly mismatched\npairs, by retaining only the set of correspondences $(i,j)$ that\ncluster together within the M\\\"{o}bius group.\n\nThere exist many ways to find clusters. In our applications, we\ngauge how far each M\\\"{o}bius transformation $m_{ij}$ is from the others\nby computing a type of $\\ell_1$ variance:\n\\begin{equation}\\label{e:variance_function}\n E_V(i,j) = \\sum_{(k,\\ell)}\\norm{m_{ij} - m_{k\\ell}},\n\\end{equation}\nwhere the norm is the Frobenius norm (also called the\nHilbert-Schmidt norm) of the $2\\times 2$ complex matrices\nrepresenting the M\\\"{o}bius transformations, after normalizing them\nto have determinant one. We then use $E_V(i,j)$ as a consistency\nmeasure of the corresponding pair $(i,j)$.\n\n\\section{Examples and comments}\n\\label{s:examples}\n\\begin{figure}[h]\n\\centering\n\\begin{tabular}{rcccc}\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei_1.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei_2.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei_1_conf.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei_2_conf.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei_polar.png} \\\\\n(a) &&&& Good pair (a)\\\\\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei2_1.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei2_2.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei2_1_conf.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei2_2_conf.png} &\n\\includegraphics[width=0.2\\columnwidth]{figures\/nei2_polar.png} \\\\\n(b) & & & & Erroneous pair (b)\n\\end{tabular}\n\\caption{Calculation of the local distance\n$d^R_{\\mu,\\nu}(\\cdot,\\cdot)$ between pairs of points on two\ndifferent surfaces (each row shows a different pair of points; the\ntwo surfaces are the same in the top and bottom rows). The first row\nshows a ``good'' pair of points together with the alignment of the\nconformal densities $\\mu,m^*\\nu$ based on the best M\\\"{o}bius\ntransformation $m$ minimizing $\\int_\\D \\norm{\\mu-m^*\\nu}d\\vol_\\mathcal{M}$.\nThe plot of this latter integral as a function of $m$ (parameterized\nby $\\sigma \\in [0,2\\pi)$, see (\\ref{e:disk_mobius})) is shown in the\nright-most column. The second row shows a ``bad'' correspondence\nwhich indeed leads to a higher local distance\n$d^R_{\\mu,\\nu}$.}\\label{fig:good_bad_pair_correspondence}\n\n\\end{figure}\n\nIn this section we present a few experimental results using our new\nsurface comparison operator. These concern an application to\nbiology; in a case study of the use of our approach to the\ncharacterization of mammals by the surfaces of their molars, we\ncompare high resolution scans of the masticating surfaces of molars\nof several lemurs, which are small primates living in Madagascar.\nTraditionally, biologists specializing in this area carefully\ndetermine landmarks on the tooth surfaces, and measure\ncharacteristic distances and angles involving these landmarks. A\nfirst stage of comparing different tooth surfaces is to identify\ncorrespondences between landmarks. Figure\n\\ref{fig:good_bad_pair_correspondence} illustrates how\n$d^R_{\\mu,\\nu}(z,w)$ can be used to find corresponding pairs of\npoints on two surfaces by showing both a ``good'' and a ``bad''\ncorresponding pair. The left two columns of the figure show the pair\nof points in each case; the two middle columns show the best fit\nafter applying the minimizing M\\\"{o}bius on the corresponding disk\nrepresentations; the rightmost column plots $ \\int_{\\Omega_{z_0,R}}\n\\,|\\,\\mu(z) - (m_{z_0,w_0,\\sigma}^*\\nu)(z)\\,|\\, d\\vol_H(z)$, the\nvalue of the ``error'', as a function of parameter $\\sigma$,\nparametrizing the M\\\"{o}bius transformations that map a give point $z_0$\nto another given point $w_0$ (see Lemma\n\\ref{lem:a_and_tet_formula_in_mobius_interpolation}). The ``best''\ncorresponding point $w_0$ for a given $z_0$ is the one that produces\nthe lowest minimal value for the error, i.e. the lowest\n$d^R_{\\mu,\\nu}(z_0,w_0)$.\n\nFigure \\ref{fig:120_corrs} show the top 120 most consistent\ncorresponding pairs (in groups of 20) for two molars belonging to\nlemurs of different species. Corresponding pairs are indicated by\nhighlighted points of the same color. These correspondences have\nsurprised the biologists from whom we obtained the data sets; their\nexperimental measuring work, which incorporates finely balanced\njudgment calls, had defied earlier automatizing attempts.\n\nOnce the differences and similarities between molars from different\nanimals have been quantified, they can be used (as part of an\napproach) to classify the different individuals. Figure\n\\ref{fig:distance_graph_embedded} illustrates a preliminary result\nfrom \\cite{Daubechies10} that illustrates the possibility of such\nclassifications based on the distance operator between surfaces\nintroduced in this paper. The figure illustrates the pairwise\ndistance matrix for eight molars, coming from individuals in four\ndifferent species (indicated by color). The clustering was based on\nonly the distances between the molar surfaces; it clearly agrees\nwith the clustering by species, as communicated to us by the\nbiologists from whom we obtained the data sets.\n\nOne final comment regarding the computational complexity of our\nmethod. There are two main parts: the preparation of the distance\nmatrix $d_{ij}$ and the linear programming optimization. For the\nlinear programming part we used a Matlab interior point\nimplementation with $N^2$ unknowns, where $N$ is the number of\npoints spread on the surfaces. In our experiments, the optimization\ntypically terminated after $15-20$ iterations for $N=150-200$\npoints, which took about 2-3 seconds. The computation of the\nsimilarity distance $d_{ij}$ took longer, and was the bottleneck in\nour experiments. If we spread $N$ points on each surface, and use\nthem all (which was usually not necessary) to interpolate the\nconformal factors $\\Gamma_\\mu, \\Gamma_\\nu$, if we use $P$ points in\nthe integration rule, and take $L$ points in the M\\\"{o}bius\ndiscretization (see Section \\ref{s:the_discrete_case_implementation}\nfor details) then each approximation of $d^R_{\\mu,\\nu}(z_i,w_j)$ by\n(\\ref{e:discrete_approx__d_mu_nu(z_i,w_j)_bis}) requires $O(L \\cdot\nP \\cdot N)$ calculations, as each evaluation of\n$\\Gamma_\\mu,\\Gamma_\\nu$ takes $O(N)$ and we need $L\\cdot P$ of\nthose. Since we have $O(N^2)$ distances to compute, the computation\ncomplexity for calculating the similarity distance matrix $d_{ij}$\nis $O(L\\cdot P \\cdot N^3)$. In practice this step was the most time\nconsuming and took around two hours for $N=300$. However, we have\nnot used any code optimization and we believe these times can be\nreduced significantly.\n\n\n\n\n\\begin{figure}[h]\n\\centering\n\\begin{tabular}{cccc}\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_1.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_3.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_5.png} \\\\\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_2.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_4.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_6.png} \\\\\n\\hline\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_7.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_9.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_11.png} \\\\\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_8.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_10.png} &\n\\includegraphics[width=0.3\\columnwidth]{figures\/i16_k06_12.png} \\\\\n\\end{tabular}\n\\caption{The top 120 most consistent corresponding pairs between two\nmolar teeth models.} \\label{fig:120_corrs}\n\\end{figure}\n\n\n\\begin{figure}[h]\n\\centering\n\\includegraphics[width=0.9\\columnwidth]{figures\/embeded_graph3.png}\n\\caption{Embedding of the distance graph of eight teeth models using\nmulti-dimensional scaling. Different colors represent different\nlemur species. The graph suggests that the geometry of the teeth\nmight suffice to classify species.}\n\\label{fig:distance_graph_embedded}\n\\end{figure}\n\n\n\n\\section{Acknowledgments}\nThe authors would like to thank C\\'{e}dric Villani and Thomas\nFunkhouser for valuable discussions, and Jesus Puente for helping\nwith the implementation. We are grateful to Jukka Jernvall, Stephen\nKing, and Doug Boyer for providing us with the tooth data sets, and\nfor many interesting comments. ID gratefully acknowledges (partial)\nsupport for this work by NSF grant DMS-0914892, and by an AFOSR\nComplex Networks grant; YL thanks the Rothschild foundation for\npostdoctoral fellowship support.\n\n\\bibliographystyle{amsplain}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\n\\section{Introduction}\\label{sec:intro}\n\nThe Transformer architecture \\cite{vaswani2017attention} has been widely successful in a wide range of natural language processing tasks, including machine translation \\cite{edunov2018understanding}, language modeling \\cite{roy2020efficient}, question-answering \\cite{karpukhin2020dense}, and many more. Transformers pre-trained on large amounts of text with a language modeling (LM) objective, have become the standard in NLP, exhibiting surprising amounts of linguistic and world knowledge \\cite{peters2018elmo, devlin2018bert, petroni2019language, hewitt2019structural,Roberts2020t5kb}.\n\nThe contextualizing component of the Transformer is the attention layer where all positions in an input sequence of length $L$ aggregate information from the entire sequence in parallel. At its core, given $L$ query, key and value vectors, the \\textit{dot-product attention} function outputs\\footnote{Usually, the term is $\\mathrm{softmax}(QK^\\top \/ \\sqrt{d})V$ but $\\sqrt{d}$ can be dropped via scaling of queries and keys.} $\\mathrm{softmax}(QK^\\top)V$ where the \\softmax{} function is applied row-wise on the matrix $QK^\\top \\in \\mathbb{R}^{L \\times L}$,\nconsisting of similarity scores of the query-key pairs. Unfortunately, computing $\\Omega(L\\cdot L)$ similarity scores is prohibitive for long sequences. \n\nTo alleviate this, past work proposed to compute an approximation\nof $\\mathrm{softmax}(QK^\\top)$. One major line of research focused on \\textit{sparse attention} variants, where only a few similarity scores are computed per position, and the rest are ignored. Methods differ by which query-key pairs are selected \\cite{child2019generating, ye2019bp, qiu2019blockwise, roy2020efficient, kitaev2020reformer, beltagy2020longformer,gupta2020gmat}. \nA second line of research explored \\textit{dense} variants \\cite{katharopoulos2020transformers,Wang2020LinformerSW,tay2020sparse} (cf.\\ \\cite{tay2020efficient} for a survey). E.g., instead of computing the attention scores exactly for only a few query-key pairs, \\cite{Choromanski2020RethinkingAW} compute an approximation of scores for all pairs.\n\nIn this work, we point to a lacuna in current research on efficient Transformers. While recent work focused on approximating the attention scores $\\mathrm{softmax}(QK^\\top)$, the true target of approximation should be the output of the attention sub-layer, namely $H = \\mathrm{softmax}(QK^\\top)V$, which also includes the value vectors, $V$. We show that ignoring value vectors leads to unwarranted consequences both theoretically and empirically.\n\nTo demonstrate the importance of value-aware approximation, we analyze \\emph{optimal sparse attention}, that is, the case where, in hindsight, the model computes dot product similarity only with the most similar key vectors, while still ignoring the value vectors.\nWe show that in the popular masked language modeling (MLM) setup, optimal sparse attention dramatically \\emph{under-performs} compared to an optimal approximation of the true output of the attention sub-layer, $H$, leading to an error increase of $8$-$20$ points. Next, by theoretically focusing on the case where queries compute similarity to the \\emph{single} most similar key vector, we show that approximating $\\mathrm{softmax}(QK^\\top)$ is equivalent to approximating $H$ when the value vectors $V$ satisfy strong orthogonality and norm constraints. Conversely, when they do not, ignoring $V$ can lead unbounded approximation error. \n\nSecond, we discuss the kernel-based view of attention, where efficiency is gained by replacing the exponential kernel (corresponding to $\\mathrm{softmax}$) with other kernel functions \\cite{katharopoulos2020transformers}. We theoretically show that while in the exponential kernel case (corresponding to $\\mathrm{softmax}$), the effect of the norm of the value vectors is potentially small, switching to other kernels can dramatically increase the importance of the value vectors. We empirically test this by comparing optimal sparse attention\ngiven different kernel functions, and see that indeed approximation quality decreases when replacing the exponential kernel, \n\nTo conclude, we theoretically and empirically show that approximating the attention score matrix alone is insufficient, and propose that the research community should instead approximate the true output of the sub-attention layer, which importantly includes value vectors. Our code and trained models are available at \\url{https:\/\/github.com\/ag1988\/value_aware_attn}.\n\n\\comment{\n\\jb{if ankit agrees, delete everything from here.}\n\n\nIn this work, working in a LM set-up, we do a comparative study of various approximation methods and new baselines. We train LMs using the original attention function and then evaluate the trained model after replacing the original attention function with a given approximation. This methodology saves us from training a large number of models from scratch and allows us to include new oracle baselines. An overview of our contributions is as follows:\n\\begin{itemize}[leftmargin=*,topsep=0pt,itemsep=0pt,parsep=0pt]\n \\item Sparse methods aim towards restricting the attention of a given query only to its most similar keys irrespective of the associated value vectors. We compare the approximation quality of sparse methods such as LSH attention \\cite{kitaev2020reformer}, sliding-window attention \\cite{beltagy2020longformer} and dense methods such as ORF attention \\cite{Choromanski2020RethinkingAW} with that of an oracle baseline \\textit{top-keys-r} where each query attends only only to its $r$ most similar keys. We find that the current methods do not perform on par with this oracle.\n \\item Working with a \\textit{kernel} view of attention \\cite{tsai2019transformer}, we experiment with various similarity metrics besides \\softmax{} and show that success of the \\textit{top-keys-r} heuristic is tied to the similarity metric (kernel) used. E.g. we find that it does not perform well in case of the polynomial kernel.\n \\item Most importantly, we point out the above methods which do not utilize the value vectors $V$ can be sub-optimal as the final output of the attention layer also depends on the value vectors $V$. We include a stronger oracle baseline \\textit{optimal-r} where, for each query, the true attention output is approximated by the optimal convex combination of at most $r$ value vectors. For instance, \\textit{optimal-$1$} approximates the true output $o = \\sum_i \\alpha_i\\cdot v_i$ corresponding to a query by the value vector closest to $o$. On the other hand, the \\textit{top-keys-$1$} oracle instead outputs the value vector corresponding to the most similar key (i.e. $v_i$ with highest $\\alpha_i$) which might not be optimal. We show that simple facts from convex geometry guarantee that the \\textit{optimal-r} oracle gives zero approximation error for $r\\geq d$ where $d$ is the dimension of the vectors. I.e. $o$ can always be expressed as a convex combination of some $d \\ll L$ value vectors. \\ag{emperical and theoretical evidence that people should work on achieving this and not that}\n\\end{itemize}\n\n\n\\jb{Right now there is an important part missing, which is what is our contribution: 'In this work, we...' with an explanation of what is it that you do: show that values can be important, have some theory on it, and some empirical experiments, and what are the main findings}\n}\n\n\\section{Background}\\label{sec:method}\n\n\n\nWe review the kernel-based view of attention \\cite{tsai2019transformer}, which will be instructive in \\S\\ref{sec:optimal}.\n\n\\paragraph{Generalized Attention} \nLet $\\kappa(x,y) = \\inner{\\Phi(x)}{\\Phi(y)} \\geq 0$ be a kernel function with feature map $\\Phi:\\mathbb{R}^d \\mapsto \\mathcal{H}$ for some implicit reproducing kernel Hilbert space (RKHS) $\\mathcal{H}$. Given a query vector $q$, keys $k_1,\\ldots,k_L$, values $v_1,\\ldots,v_L$, all in $\\mathbb{R}^d$:\n\\begin{equation}\\label{eqn:attention}\n\\mathrm{att}_\\kappa(q,k_1,\\ldots,v_1,\\ldots) = \\frac{\\sum_{i=1}^{L} \\kappa(q,k_i)v_i}{\\sum_{i=1}^{L} \\kappa(q,k_i)},\n\\end{equation}\nwhere the normalization induces a probability distribution $\\balpha$ over the value vectors with $\\alpha_i = \\kappa(q,k_i) \/ \\sum_i \\kappa(q,k_i)$. The most popular use case is the exponential kernel $\\kappa(x,y) = \\exp(\\inner{x}{y})$, referred to as dot-product attention in Transformers. \nSome other examples include the degree-$2$ \\textit{polynomial} kernel $\\kappa(x,y) = \\inner{x}{y}^2$ and the recently proposed \\textit{elu} kernel $\\inner{\\Phi(x)}{\\Phi(y)}$ with $\\Phi(\\cdot) = 1 + \\mathrm{ELU}(\\cdot)$ \\cite{katharopoulos2020transformers}.\n\nGiven $L \\gg d$ queries, the attention function (Eq. \\ref{eqn:attention}) requires computing $L\\cdot L$ similarity scores for the query-key pairs, which is prohibitive for long sequences. \n\\textit{Sparse attention} variants relax this requirement and compute only a few similarity scores, ignoring the rest:\n\\begin{equation}\\label{eqn:sparse_attention}\n\\mathrm{att}_{\\kappa, S} = \\frac{\\sum_{i\\in S} \\kappa(q,k_i)v_i}{\\sum_{i\\in S} \\kappa(q,k_i)},\n\\end{equation}\nfor some $S \\subseteq \\{1,\\ldots,L\\}, |S|\\ll L$.\nMethods differ in how $S$ is determined given the queries and keys, and include use of locality bias \\cite{beltagy2020longformer}, global memory \\cite{gupta2020gmat}, and LSH hashing \\cite{kitaev2020reformer}, among others.\nConversely, instead of exactly computing the attention scores only on a few query-key pairs, \\textit{dense} variants compute an approximation of the true kernel values for all pairs. Such methods output $\\sum_i \\beta_i\\cdot v_i$ for some approximation $\\bbeta$ of the the true attention distribution $\\balpha$ \\cite{Choromanski2020RethinkingAW,peng2021random}.\n\n\n\\comment{\n\\jb{Again, I think prob. it's good to have the intro at a slightly higher level that is clear to everyone and then have a section about the kernel-based view where people will learn about this}\n\nThe majority \\jb{why majority and not all?} of the above variants (LSH, Routing, ORF, etc \\jb{you did not define these things, so either explain or delete}) do not utilize the value vectors while producing the approximation. Given a query, methods such as LSH, Routing attention, etc \\jb{these methods were not mentioned so are unclear} aim to restrict $S$ only to the most similar keys irrespective of the associated value vectors. \\jb{you should say something that 'what we really care about is not $QK^\\top$, but the output of the layer, which is also affected by $V$}.\nGiven this, it is not immediately clear if this is a reasonable strategy or whether value-aware approximations can be significantly more accurate \\jb{what do you mean by value-aware? be specific that you mean to approximate with $V$}.\n}\n\n\n\n\n\n\n\n\n\n\\section{Optimal Sparse Attention}\\label{sec:optimal}\n\n\nPrior methods for approximating attention, ignored the contribution of the values vectors $V$. As the true output of the attention sub-layer also depends on $V$, a natural question is whether it is possible to design better approximation methods by incorporating $V$, and if so, how much improvement is even possible? \n\nTo answer this, we focus on sparse attention, and analyze the difference between an oracle sparse approximation that considers the value vectors, and an oracle approximation that does not. That is, we look at the difference between the two approximations from the perspective of \\emph{expressivity}, ignoring any memory and computational constraints. We denote an optimal value-aware approximation that uses $r$ key vectors per query by \\emph{optimal-v-aware-r}, and an optimal approximation that ignores value vectors by \\emph{optimal-v-oblivious-r}. \nWe define \\emph{optimal-v-oblivious-r} as the output of Eq.~\\ref{eqn:sparse_attention} in which $S$ is selected to be the $r$ indices with the highest attention scores $\\alpha_i$'s. This is a natural baseline since this is what current sparse methods are trying to emulate.\nWe now explicitly derive and analyze the value-aware objective.\n\n\n \n\\paragraph{Value-aware objective} Let $o = \\sum_{i=1}^L \\alpha_iv_i$ be a convex combination of $v_1,\\ldots,v_L \\in \\mathbb{R}^d$, corresponding to the true output of the attention sub-layer.\nLet $C_r = \\{\\sum_{i=1}^L \\beta_iv_i: \\forall i\\ \\beta_i \\geq 0, \\sum_i \\beta_i=1, |\\{\\beta_i: \\beta_i > 0\\}| \\leq r\\}$ denote the set of points in the polytope of $v_i$'s that can be expressed as a convex combination of at most $r$ value vectors $v_i$.\nThe goal of value-aware approximation is to solve for the point in the constrained region $C_r$ closest to the true output $o$, i.e. $\\mathrm{argmin}_{\\tilde{o} \\in C_r} ||o-\\tilde{o}||^2$. As mentioned, this solution is termed \\textit{optimal-v-aware-r}.\n\nWe consider two extreme cases of $r$: $r=1$ and $r\\geq d+1$. For $r\\geq d+1$, the Carath{\\'e}odory Theorem \\cite{Caratheodory} states that $o = \\sum_i \\alpha_iv_i$ can be expressed as a convex combination of at most $d+1$ $v_i$'s. Hence, if $r \\geq d+1$ then $o \\in C_r$ and the optimal approximation error is $0$.\nIn most popular architectures, such as BERT \\cite{devlin2018bert}, $d=64 \\ll L$. This means that from the point of expressivity, \\emph{optimal-v-aware-65} can obtain a perfect approximation. Conversely, we will show in \\S\\ref{sec:experiments} that the performance of \\emph{optimal-v-oblivious-65} is substantially lower.\n\n\nAt the other extreme, when $r=1$ (a single value vector), the above objective is equivalent to $\\mathrm{argmin}_{i \\in (1,\\dots,L)} ||o-v_i||^2$ and can be simplified as\n\\setlength{\\abovedisplayskip}{2pt}\n\\setlength{\\belowdisplayskip}{2pt}\n\\begin{equation}\\label{eqn:top_1}\n\\begin{split}\n &\\ \\mathrm{argmin}_{i} ||o||^2 + ||v_i||^2 -2\\inner{v_i}{o} \\\\\n= &\\ \\mathrm{argmin}_{i} ||v_i||^2 -2\\inner{v_i}{\\sum_{j} \\alpha_jv_j} \\\\ \n= &\\ \\mathrm{argmin}_{i} ||v_i||^2(0.5-\\alpha_i) -\\sum_{j\\neq i} \\alpha_j\\inner{v_i}{v_j}.\n\\end{split}\n\\end{equation}\n\nThis equation induces a ranking over value vectors that \\emph{depends} on the value vectors themselves, in contrast to a value-oblivious ranking induced solely by attention weights $\\balpha$. \n\\setlength{\\abovedisplayskip}{6pt}\n\\setlength{\\belowdisplayskip}{6pt}\n\nIf $v_1,\\ldots,v_L$ are orthogonal, the above equation further simplifies to $\\mathrm{argmin}_{i} ||v_i||^2(0.5-\\alpha_i) - \\sum_{j\\neq i} \\alpha_j\\cdot0 = \\mathrm{argmin}_{i} ||v_i||^2(0.5-\\alpha_i)$. In this case, if some $\\alpha_i \\geq 0.5$ or if $v_1,\\ldots,v_L$ have equal norms, this would further simplify to $\\mathrm{argmax}_{i} \\alpha_i$, and would therefore be independent of the value-vectors $v_i$'s, implying that a value-oblivious approximation would work well.\n\nBut such assumptions on $v_1, \\ldots, v_L$ do not hold in general and thus an approximation that only depends on $\\alpha_i$'s can be sub-optimal. E.g., let $v_1, v_2, v_3$ be orthogonal vectors $(1,0,0)$, $(0,2,0)$, $(0,0,3)$ respectively and let $\\alpha_1, \\alpha_2, \\alpha_3$ be $0.25, 0.35, 0.4$. Then $v_3$ with the highest attention weight $\\alpha_3$ has a squared distance of $3.79$ from the true output $\\sum_i \\alpha_iv_i$ whereas $v_1$ with the least attention weight $\\alpha_1$ has only $2.49$. In this case, \\emph{optimal-v-aware-1} induces exactly the opposite ranking of value vectors compared to \\emph{optimal-v-oblivious-1}. Moreover, if we increase the value $3$ in $v_3$ to infinity, the approximation error will also infinitely grow. This example and, in general, Eq.~\\ref{eqn:top_1} also show that the optimal ranking can be significantly different from the one induced by $\\alpha_i ||v_i||$ proposed recently by \\cite{kobayashi-etal-2020-attention} for obtaining better interpretability of attention models.\n\n\n\n\n\\paragraph{Effect of kernel function} Recently, Linear Transformer \\cite{katharopoulos2020transformers} proposed to replace the existing exponential kernel with more efficient kernels. We now show that replacing the exponential kernel with a polynomial kernel can lead to a drop in quality for current sparse approximation methods.\n\nIntuitively, because the kernel function affects the skewness of $\\balpha$, it also affects the difference between the ranking induced by the optimal-value-aware approximation and the optimal-value-oblivious one. For simplicity, consider the case of orthogonal value vectors in which Eq.~\\ref{eqn:top_1} simplifies to $\\mathrm{argmin}_{i} ||v_i||^2(0.5-\\alpha_i)$. From Eq.~\\ref{eqn:attention}, we have $\\alpha_i = \\kappa(q,k_i) \/ \\sum_j \\kappa(q,k_j)$ which is $\\inner{q}{k_i}^C \/ \\sum_j \\inner{q}{k_j}^C$ for the degree-$C$ polynomial kernel. For $C = 0$, we have $\\alpha_i = 1\/L$, which gives $\\mathrm{argmin}_{i} ||v_i||^2$. In this case, the value vectors become crucial when $\\balpha$ is uniform. On the other hand, assuming distinct inner products, for $C \\gg 0$ we will obtain $\\max_i \\alpha_i \\geq 0.5$, thereby reducing us to $\\mathrm{argmax}_{i} \\alpha_i$, where value vectors do not affect the approximation. The complexity of the Transformer grows exponentially with the degree $C$ and thus in practice a low $C$ must be used (e.g., degree-$2$ polynomial).\nIn such case, $\\balpha$ is likely to be less skewed compared to the exponential kernel and more likely to induce a sub-optimal ranking.\n\nIn the next section, we empirically verify the above observations and show a significant performance gap between value-oblivious approximations and value-aware ones.\n\n\n\n\\section{Experiments}\\label{sec:experiments}\n\nWe empirically verify our observations in the context of training causal and masked language models, which are known to strongly correlate with performance on downstream applications \\cite{radford2019language,devlin2018bert}. \n\n\\paragraph{Masked LM task} We form examples by sampling sequences and replacing sub-words with \\texttt{} following the procedure in \\cite{devlin2018bert}. The model is trained to maximize the log probability of the masked out tokens and we evaluate the \\emph{error} of the model as the percentage of masked tokens predicted incorrectly. As approximate attention becomes increasingly relevant for long sequences, we train \\robertal{} on sequences of length $4096$ (Fig.~\\ref{figure:mlm_training}). Training was warm-started using \\roberta{}-base \\cite{liu2019roberta}. Full details on the experimental setup are in \\S\\ref{sec:mlm_data}. After training the model for $\\sim2.5$M steps, the error of the model (that is, proportion of incorrect predictions) on the evaluation set was $24.2$ (compared to $26.6$ for an analogous training on $512$-long sequences), ensuring that tokens in \\robertal{} indeed attend over longer distances and result in higher quality representations. We then replace the attention function of the trained model with various approximation schemes and evaluate the resulting model on the evaluation set.\n\nWe first compare \\emph{optimal-v-oblivious-r} to \\emph{optimal-v-aware-r}. We know that the approximation error of value-aware approximation is $0$ for $r > 64$. For $r=1$, we exhaustively go through all possible values and choose the one that minimizes the value-aware objective. As seen in Fig.~\\ref{figure:mlm_eval_top_r} and Table~\\ref{table:mlm_error}, \nthere is substantial gap between the two approximations. For instance, \\emph{optimal-v-oblivious-65} gives an MLM error of $43.5$ whereas the error of \\emph{optimal-v-aware-65} is $24.2$, since it can perfectly approximate full attention. Moreover, we compare \\emph{optimal-v-oblivious-r} to existing approximations: (a) \\emph{sliding-window-r}, where a position attends to $r\/2$ positions to its left and right), (b) LSH attention \\cite{kitaev2020reformer} and (c) ORF attention \\cite{Choromanski2020RethinkingAW}. Fig.~\\ref{figure:mlm_eval_top_r} shows that \\emph{sliding-window-r} trails behind \\emph{optimal-v-oblivious-r}.\nLSH attention, which tries to emulate \\emph{optimal-v-oblivious-r}, either requires a large number of hash rounds or a large chunk size. Similarly, the dense approximation, ORF, provides an unbiased approximation of the exponential kernel but suffers from high variance in practice.\n\n\n\\begin{table}[h]\\setlength{\\tabcolsep}{3.6pt}\n \\scriptsize\n \\centering\n \\begin{tabular}{c|c|c|c|c|c|c|c}\\hline\n exact & \\begin{tabular}[c]{@{}c@{}} OVO\\\\ $1$\\end{tabular} & \\begin{tabular}[c]{@{}c@{}} OVO\\\\ $65$\\end{tabular} & \\begin{tabular}[c]{@{}c@{}} OVA\\\\ $1$\\end{tabular} & \\begin{tabular}[c]{@{}c@{}} OVA\\\\ $65$\\end{tabular} & \\begin{tabular}[c]{@{}c@{}} ORF\\\\ $256$ features\\end{tabular} & \\begin{tabular}[c]{@{}c@{}} LSH\\\\ $r=64$ \\\\ $4$-rounds \\end{tabular} & \\begin{tabular}[c]{@{}c@{}} LSH\\\\ $r=512$ \\\\ $16$-rounds \\end{tabular} \\\\\\hline\n 24.2 & 96.6 & 43.5 & 88.6 & 24.2 & 89.79 & 90.39 & 26.11 \\\\\\hline\n \\end{tabular}\n \\caption{MLM error of \\robertal{} on the evaluation set using approximate attention described in \\S\\ref{sec:experiments}. OVO: \\emph{optimal-v-oblivious}, OVA: \\emph{optimal-v-aware}. In LSH, each query attends to a total of $r$ keys per hash round.}\n \\label{table:mlm_error}\n\\end{table}\n\n\n\n\n\n\\begin{table}[h]\\setlength{\\tabcolsep}{5pt}\n \\scriptsize\n \\centering\n \\begin{tabular}{c|c|c|c|c|c}\\hline\n & exact & OVO-1 & OVO-65 & OVA-1 & OVA-65 \\\\\\hline\n exponential & 30.5 & 1031.1 & 33.5 & 280.3 & 30.5 \\\\\\hline\n polynomial (deg 2) & 34.2 & 6700.2 & 310.2 & 1005.4 & 34.2 \\\\\\hline\n elu & 35.3 & 1770.6 & 62.7 & 837.4 & 35.3 \\\\\\hline\n \\end{tabular}\n \\caption{Evaluation perplexity of models using approximate attention. OVO: \\emph{optimal-v-oblivious}, OVA: \\emph{optimal-v-aware}.}\n \\label{table:lm_loss}\n\\end{table}\n\n\\begin{figure}[h!]\n \\centering\n \\includegraphics[scale=0.45]{figures\/rbt_4096_top_r.pdf}\n \\caption{Evaluation of MLM error of \\robertal{} after replacing vanilla attention with approximation schemes. Dashed line denotes error using vanilla attention.}\n\\label{figure:mlm_eval_top_r}\n\\end{figure}\n\n\\begin{figure}[h!]\n \\centering\n \\includegraphics[scale=0.45]{figures\/kernels_512_top_r.pdf}\n \\caption{Evaluation loss (base e) of \\emph{optimal-v-oblivious-r} oracle on the causal LM task for distinct kernel functions.}\n\\label{figure:kernels_top_r}\n\\end{figure}\n\n\\paragraph{Causal LM task} To investigate the effect of the kernel function on the quality of value-oblivious methods, we train a $6$-layer Transformer LM over 512 tokens on WikiText-103 \\cite{Merity2017PointerSM} (details in \\S\\ref{sec:wikitext}). We train $3$ models with identical hyperparameters using the exponential, degree-$2$ polynomial, and elu kernels respectively and evaluate the trained models with value-aware and value-oblivious approximations. \nAgain, \\emph{optimal-v-aware-r} substantially outperforms \\emph{optimal-v-oblivious-r} (Table~\\ref{table:lm_loss}), pointing to the potential of working on approximating the value-aware objective. \nMore importantly, comparing the approximation quality across different kernel functions (Fig.~\\ref{figure:kernels_top_r}), we see that the gap between the three kernels is small when using full attention (512 keys) vectors. However, convergence is much slower for the elu kernel, and especially the degree-$2$ polynomial, demonstrating that the approximation based on the top-$r$ key vectors is sub-optimal when switching to a less skewed kernel, which is more affected by the value vectors.\n\n\n\\section{Conclusions}\nIn this work, we provide theoretical and empirical evidence against current practice of focusing on approximating the attention matrix in Transformers, while ignoring the value vectors. We propose a value-aware objective and argue that the efforts to develop more efficient Transformers should consider this objective function as a research target.\n\n\\section{}{8pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}\n\n\\usepackage{float} \n\n\n\\title{Value-aware Approximate Attention}\n\n\\author{\n Ankit Gupta \\\\\n Tel Aviv University \\\\\n {\\tt {\\normalsize ankitgupta.iitkanpur@gmail.com}} \\\\\\And\n Jonathan Berant \\\\\n Tel Aviv University, \\\\\n Allen Institute for AI \\\\\n {\\tt {\\normalsize joberant@cs.tau.ac.il}} \\\\}\n\n\n\\begin{document}\n\\maketitle\n\n\\setlength{\\abovedisplayskip}{6.5pt}\n\\setlength{\\belowdisplayskip}{6.5pt}\n\n\n\\input{0_abstract}\n\\input{1_introduction}\n\\input{2_method}\n\\input{3_optimal}\n\\input{4_experiments}\n\n\\section*{Acknowledgments}\nThis research was partially supported by \nThe Yandex Initiative for Machine Learning, and the European Research Council (ERC) under the European Union Horizons 2020 research and innovation programme (grant ERC DELPHI 802800).\n\n\n\\section{Supplemental Material}\n\\label{sec:supplemental}\n\n\\subsection{Masked LM task}\\label{sec:mlm_data}\nThe instances for the MLM task (\\S\\ref{sec:experiments}) were formed separately using the corpora listed in Table ~\\ref{table:mlm_data}. For each dataset, after appending \\texttt{<\/s>} token at the end of each document, the documents were arranged in a random order and concatenated into a single long text which was then tokenized into a list of sub-words. Depending upon the final input sequence length $L$ of the experiment ($512$\/$4096$) this list was chunked into full length $L-2$ sequences which were then masked randomly following \\cite{devlin2018bert} and enclosed within \\texttt{} and \\texttt{<\/s>} tokens. To handle sequences longer than $512$ tokens, the positional embeddings were used following \\cite{gupta2020gmat}. The learning curves of \\robertas{} and \\robertal{} are in Fig.~\\ref{figure:mlm_training}.\n\n\\begin{figure}[ht]\n \\centering\n \\includegraphics[scale=0.45]{figures\/rbt_full_4096_mix.pdf}\n \\caption{Evaluation error on the MLM task using vanilla attention (computing the full attention matrix).}\n\\label{figure:mlm_training}\n\\end{figure}\n\n\\begin{table}[h!]\\setlength{\\tabcolsep}{6pt} \n \\scriptsize\n \\centering\n \\begin{tabular}{c|c|c|c}\\hline\n corpus & all & training & evaluation \\\\\\hline\n Wikipedia ($10$\/$2017$) & $2.67$B & $1.53$B & $1.02$M\\\\\\hline\n BookCorpus \\cite{Zhu_2015_ICCV} & $1.06$B & $1.02$B & $1.02$M\\\\\\hline\n ArXiv \\cite{Cohan2018ADA} & $1.78$B & $1.53$B & $1.02$M\\\\\\hline\n PubMed \\cite{Cohan2018ADA} & $0.47$B & $510$M & $1.02$M\\\\\\hline\n PG19 \\cite{raecompressive2019} & $3.06$B & $510$M & $1.02$M\\\\\\hline\n \\end{tabular}\n \\caption{Number of tokens in the datasets used for MLM training.}\n \\label{table:mlm_data}\n\\end{table}\n\n\\paragraph{Hyperparameters} For convenience, we denote the training hyperparameters using the following abbreviations, INS: number of training instances, BSZ: number of instances in a batch, ISZ: instance size, SQL: final input sequence length after rearranging BSZ instances each of length ISZ, LR: learning rate, WRM: linear LR warm-up proportion, EP: number of epochs, STP: number of optimizer steps, GAC: gradient accumulation steps, POSq: whether (y\/n) $q$ part is included in positional embeddings. The hyperparameters are listed in Table~\\ref{table:hyperparams_mlm}.\n\n\\begin{table}[h!]\\setlength{\\tabcolsep}{2pt}\n \\scriptsize\n \\centering\n \\begin{tabular}{c|c|c|c|c|c|c|c|c|c} \\hline\n \n model & init & BSZ & ISZ & SQL & LR & WRM & EP & STP & POSq \\\\\\hline\n \\robertas{} & \\roberta{} & $8$ & $512$ & $512$ & $5$e-$6$ & $0.1$ & $2$ & $2.476$M & n \\\\\\hline\n \\robertal{} & \\roberta{} & 8 & $512$ & $4096$ & $5$e-$6$ & $0.1$ & $2$ & $2.476$M & y \\\\\\hline\n \\end{tabular}\n \\caption{Training hyperparameters. Common parameters: INS=$10$M, dropout-rate=$0.0$, optimizer=Bert-Adam, $\\beta_1$=$0.9$, $\\beta_2$=$0.98$, weight-decay=$0.01$, max-grad-norm=$5.0$, seed=$42$, GAC=$1$.}\n \\label{table:hyperparams_mlm}\n\\end{table}\n\n\\paragraph{Details of LSH attention} Given $L$ queries and $L$ keys in $\\mathbb{R}^d$, in each hash round, we sample a new matrix $R \\in \\mathbb{R}^{\\frac{C}{2} \\times d}$ of standard gaussians and hash the queries and keys as $H_R(x) = \\mathrm{argmax}([-Rx;Rx]) \\in \\{1,\\ldots,C\\}$. We rearrange the queries (and similarly keys) according to their hash value, breaking ties using the original position, and then chunk them into $L\/B$ chunks of $B$ vectors each. Denoting these chunks as $Q_1,\\ldots,Q_{L\/B}$ and $K_1,\\ldots,K_{L\/B}$, for each query in $Q_i$ we compute its similarity scores with respect to all keys in $K_{i-1},K_i$. I.e.~in each hash round a query attends to $r=2B$ keys. For each query, these similarity scores are accumulated over different hash rounds, and at the end normalized by their sum to get normalized attention scores over the keys. As recommended in the original paper \\cite{kitaev2020reformer}, we use $C=2L\/B=4L\/r$ which in practice can be sub-optimal as rearrangement destroys the original locality structure. \n\n\\paragraph{Details of ORF attention} Given $L$ queries and $L$ keys in $\\mathbb{R}^d$ we divide each vector by $d^{\\frac{1}{4}}$ to account for the temperature term in dot-product attention. For a given number $F$ of features, we sample a random orthogonal matrix $R \\in \\mathbb{R}^{F \\times d}$ as described in \\cite{saxe2013exact} and provided as a tensor initialization option in PyTorch. We then map each vector to the feature space as $\\Phi(x) = \\frac{1}{\\sqrt{F}}\\exp\\left(Rx - \\frac{||x||^2}{2}\\right)\\in \\mathbb{R}^F$ where ($-$) and $\\exp$ operations are applied element-wise. Similarity score of a query-key pair $(q, k)$ is computed as $\\inner{\\Phi(q)}{\\Phi(k)}$ and and is normalized by the sum of the similarity scores of $q$ with all the keys. Computing this directly leads to numerical instability so we instead compute $\\Phi(q) = \\frac{1}{\\sqrt{F}}\\exp\\left(Rq - \\frac{||q||^2}{2} - \\max(Rq)\\right)$ for queries and $\\Phi(k) = \\frac{1}{\\sqrt{F}}\\exp\\left(Rk - \\frac{||k||^2}{2} - \\max(RK)\\right)$ where $K$ is the matrix of all keys and $\\max$ is over all elements of input. \n\nThe main idea behind ORF attention is that, for a vector $w$ of standard gaussians, $\\inner{w}{x} \\sim \\mathcal{N}(0,||x||^2)$ and from the properties of log-normal distributions, $\\mathbb{E}_{w}[\\exp(\\inner{w}{x})] = \\exp(\\frac{||x||^2}{2})$. So, $\\mathbb{E}_{w}[\\exp(\\inner{w}{q})\\cdot\\exp(\\inner{w}{k})] = \\mathbb{E}_{w}[\\exp(\\inner{w}{q+k})] = \\exp(\\frac{||q+k||^2}{2}) = \\exp(\\inner{q}{k}+\\frac{||q||^2}{2}+\\frac{||k||^2}{2})$. Appropriately scaling both sides gives, $\\mathbb{E}_{w}[\\exp(\\inner{w}{q} - \\frac{||q||^2}{2})\\cdot\\exp(\\inner{w}{k}-\\frac{||k||^2}{2})] = \\exp(\\inner{q}{k})$, which is exactly the term for the exponential kernel.\n\n\n\\subsection{Causal LM task}\\label{sec:wikitext}\nFor this task, we used the language modeling framework provided by Faiseq\\footnote{\\url{https:\/\/github.com\/pytorch\/fairseq}}.\n\\paragraph{Model and training details} number of decoder layers: $6$, hidden size: $512$, head size: $64$, number of model parameters: $156$M, dataset: WikiText-$103$, training examples: $1801350$, input sequence length: $512$, $\\beta_1$=$0.9$, $\\beta_2$=$0.98$, weight-decay: $0.01$, gradient clip-norm: none, learning rate: $0.0005$, learning rate schedule: inverse square root, number of warmup updates: $4000$, batch size: $128$, epochs: $20$, number of steps: $31520$, minimum context-window during evaluation on test-set: $400$.\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\n\\noindent\n{\\it Introduction.}\nBesides the mass, electric charge and other quantum numbers, the calculable electric and magnetic dipole moments are among the basic attributes of elementary particles.\nTogether with the Yukawa coupling inferred from the mass, they provide excellent opportunities to tests the standard model (SM) and probe new physics. \n\nThe 4.2$\\sigma$ deviation of the measured value of the muon anomalous magnetic moment from the SM prediction, $\\Delta a_\\mu = (2.51 \\pm 0.59)\\times 10^{-9}$~\\cite{Abi:2021gix, Aoyama:2020ynm}, can be comfortably explained even by very heavy new particles as a result of the chiral enhancement from the Higgs coupling to new particles, see Fig.~\\ref{fig:diags} (left). With order one couplings, the scale of new physics up to $\\sim 10$ TeV is expected, and it further extends to $\\gtrsim 50$ TeV for couplings close to the perturbativity limit~\\cite{Dermisek:2020cod,Capdevilla:2021rwo,Dermisek:2021ajd,Allwicher:2021jkr}. Such heavy particles are far beyond the reach of the Large Hadron Collider (LHC) and currently envisioned future experiments.\n\n\nIn this letter we show that any new interaction resulting in a chirally enhanced contribution to the muon magnetic moment necessarily modifies the muon Yukawa coupling, and thus the decay of the Higgs boson to muon pairs, or, if $h\\to \\mu^+\\mu^-$ is not modified, the muon electric dipole moment ($\\mu$EDM) of certain size must be generated (with one exception noted later). These three observables are highly correlated, and near future measurements of $h\\to \\mu^+\\mu^-$ will carve an ellipse in the plane of dipole moments for any such model. Together with the improved measurement of the electric dipole moment many models able to explain $\\Delta a_\\mu$ can be efficiently tested.\nFurthermore, in some scenarios the heaviest possible spectrum will be tested the most efficiently. \n\nThe main results can be intuitively understood from Fig.~\\ref{fig:diags}. No matter what the quantum numbers of $X$, $Y$ and $Z$ particles are, as long as they can form the diagram on the left, the photon can be removed and the $Y-Z-H$ coupling and its conjugate can be used again to generate the diagram on the right top. This effectively generates dimension 6 mass operator, $\\bar{\\mu}_{L}\\mu_{R}H\\left(H^{\\dagger}H\\right)$. In addition, for models where $X$ is a scalar participating in electroweak symmetry breaking, for example the SM Higgs boson, the same operator could be generated at tree level as in the diagram on the right bottom. We refer to these cases hereafter as loop models and tree models, respectively. The tree models have been studied in connection with $\\Delta a_{\\mu}$ in~\\cite{Kannike:2011ng,Dermisek:2013gta,Dermisek:2014cia,Poh:2017tfo,Crivellin:2018qmi,Dermisek:2020cod,Dermisek:2021ajd}, whereas examples of loop models,~\\cite{Moroi:1995yh,Huang:2001zx,Cheung:2009fc,Endo:2013lva,Freitas:2014pua,Thalapillil:2014kya,Omura:2015nja,Calibbi:2018rzv,Crivellin:2018qmi,Crivellin:2020tsz,Babu:2020hun,Capdevilla:2021rwo,Crivellin:2021rbq,Babu:2021jnu,Bigaran:2021kmn,MuonCollider:2022xlm}, include scenarios with familiar particles in the loop: superpartners, top quark, or the $\\tau$ lepton; and particles solely introduced to explain $\\Delta a_\\mu$. The generated operator contributes differently to the muon mass and Yukawa coupling as a result of different combinatorial factors. This necessarily modifies the rate for $h\\to \\mu^+\\mu^-$, unless the modified Yukawa coupling has the same magnitude as that in the SM, which is possible with complex couplings that in turn predict a certain value of $\\mu$EDM. \n\n\n\n\n\n\n\\begin{figure}[t]\n\\includegraphics[width=0.8\\linewidth]{loop_tree_diags_v2.pdf}\n\\caption{A generic diagram with chiral enhancement contributing to muon dipole moments (left), a corresponding diagram contributing to the dimension 6 mass operator at 1-loop level (right top) and at tree level, if possible, (right bottom).}\n\\label{fig:diags}\n\\end{figure}\n\nPossible correlations between $\\Delta a_\\mu$ and $h\\to \\mu^+\\mu^-$ were pointed out before~\\cite{Kannike:2011ng,Dermisek:2013gta,Dermisek:2014cia,Thalapillil:2014kya,Poh:2017tfo,Crivellin:2020tsz,Babu:2020hun,Dermisek:2020cod,Dermisek:2021ajd,Crivellin:2021rbq}. Similarly $\\mu$EDM was also studied in connection with $\\Delta a_{\\mu}$ but only as a possible effect if couplings are complex~\\cite{Cheung:2009fc,Crivellin:2018qmi,Babu:2020hun,Bigaran:2021kmn,MuonCollider:2022xlm}. The sharp correlation between all three observables has not been noticed. As we will see, with complex couplings, predictions for $h\\to \\mu^+\\mu^-$ cannot be made based only on $\\Delta a_\\mu$. Rather a given $h\\to \\mu^+\\mu^-$ translates into a prediction for $\\mu$EDM and vice versa. \n\n\n\n\\noindent\n{\\it Effective lagrangian.} For our discussion, the relevant terms of the effective Lagrangian are:\n\\begin{eqnarray}\n\\mathcal{L}\\supset &-&y_{\\mu}\\bar{l}_{L}\\mu_{R}H \\;-\\; C_{\\mu H}\\bar{l}_{L}\\mu_{R}H\\left(H^{\\dagger}H\\right) \\nonumber \\\\\n&-& C_{\\mu \\gamma} \\bar{l}_{L}\\sigma^{\\rho\\sigma}\\mu_{R} H F_{\\rho\\sigma} + h.c.,\n\\label{eq:eff_lagrangian}\n\\end{eqnarray}\nwhere the components of the lepton doublet are $l_{L}=(\\nu_{\\mu}, \\mu_{L})^{T}$, $\\sigma^{\\rho\\sigma}=\\frac{i}{2}[\\gamma^{\\rho},\\gamma^{\\sigma}]$, and all the parameters can be complex. The first term is the usual muon Yukawa coupling in the SM. When the Higgs field develops a vacuum expectation value, $H=(0,v+h\/\\sqrt{2})^T$ with $v=174$ GeV, the dimension 6 operator in the second term generates additional contributions to the muon mass and muon coupling to the Higgs boson, while the dimension 6 operator in the third term corresponds to muon dipole moments. Defining the muon Yukawa coupling and the electric and magnetic dipole moments in terms of Dirac spinors in the basis where the muon mass, $m_\\mu$, is real and positive,\n\\begin{eqnarray}\n\\mathcal{L}\\supset &&- m_{\\mu} \\bar{\\mu}\\mu - \\frac{1}{\\sqrt{2}} \\left(\\lambda^{h}_{\\mu\\mu}\\bar{\\mu}P_{R}\\mu h + h.c.\\right)\\nonumber \\\\\n&&\\;\\;+ \\frac{\\Delta a_{\\mu}e}{4m_{\\mu}}\\bar{\\mu}\\sigma^{\\rho\\sigma}\\mu F_{\\rho\\sigma} - \\frac{i}{2}d_{\\mu}\\bar{\\mu}\\sigma^{\\rho\\sigma}\\gamma^{5}\\mu F_{\\rho\\sigma},\n\\label{eq:eff_lagrangian_2}\n\\end{eqnarray}\nwe have \n\\begin{eqnarray}\nm_{\\mu}&=&\\left(y_{\\mu}v + C_{\\mu H}v^{3}\\right)e^{-i\\phi_{m_{\\mu}}}, \\label{eq:mmu}\\\\\n\\lambda_{\\mu\\mu}^{h}&=&\\left(y_{\\mu} + 3C_{\\mu H}v^{2}\\right)e^{-i\\phi_{m_{\\mu}}}, \\label{eq:mmu_lamhmu} \\\\\n\\Delta a_{\\mu} &=&- \\frac{4m_{\\mu}v}{e}\\textrm{Re}[C_{\\mu \\gamma}e^{-i\\phi_{m_{\\mu}}}], \\label{eq:mdipole}\\\\\nd_{\\mu} &=& 2v\\textrm{Im}[C_{\\mu \\gamma}e^{-i\\phi_{m_{\\mu}}}],\n\\label{eq:edipole}\n\\end{eqnarray}\nwhere $e$ is positive and $\\phi_{m_{\\mu}}$ is the phase of the rotation required to make the mass term real and positive. All the parameters are real except for $\\lambda_{\\mu\\mu}^{h}$ which can be complex. $\\lambda_{\\mu\\mu}^{h}$ and $m_{\\mu}$ do not follow the expected scaling in the SM and \n\\begin{equation}\nR_{h\\to \\mu^+\\mu^-} \\equiv \\frac{BR(h\\to \\mu^+\\mu^-)}{BR(h\\to \\mu^+\\mu^-)_{SM}} = \\left(\\frac{v}{m_{\\mu}}\\right)^{2}\\big|\\lambda_{\\mu\\mu}^{h}\\big|^{2}\n\\end{equation}\nin general deviates from 1.\n\n\n\n\n\n\n\n\n\n\n\\noindent\n{\\it The muon ellipse.} The crucial observation is that the couplings which generate chirally-enhanced contributions to $C_{\\mu\\gamma}$, also necessarily generate $C_{\\mu H}$ with the same phase. Although all the couplings in diagrams in Fig.~\\ref{fig:diags} can be complex, the same combination of couplings enter both $C_{\\mu\\gamma}$ and $C_{\\mu H}$ for tree models, with an additional factor of $\\lambda_{YZ} \\lambda_{YZ}^*$ for loop models. Thus the two Wilson coefficients are related by a {\\it real factor}, $k$, define as\n\\begin{equation}\nC_{\\mu H} = \\frac{k}{e} C_{\\mu\\gamma}.\n\\label{eq:WC_relation}\n\\end{equation}\nThis allows us to write $\\lambda_{\\mu\\mu}^{h}$ and thus $R_{h\\to \\mu^+\\mu^-}$ in terms of electric and magnetic dipole moments:\n\\begin{flalign}\nR_{h\\to \\mu^+\\mu^-}=\\left(\\frac{\\Delta a_{\\mu}}{2\\omega} - 1\\right)^{2} + \\left(\\frac{m_{\\mu}d_{\\mu}}{e\\omega}\\right)^{2},\n\\label{eq:ellipse}\n\\end{flalign}\nwhere $\\omega = m_{\\mu}^{2}\/kv^{2}$. Note that $\\Delta a_{\\mu}$ can both increase or decrease $R_{h\\to \\mu^+\\mu^-}$ depending on its sign and the sign of $k$, while $d_{\\mu}$ can only increase $R_{h\\to \\mu^+\\mu^-}$.\n\n\\begin{figure}[t]\n\\includegraphics[width=0.65\\linewidth]{contour_generick.pdf} \n\\includegraphics[width=0.65\\linewidth]{contour_SMVLL_R1c.pdf} \n\\includegraphics[width=0.65\\linewidth]{contour_genericks2351025_final.pdf} \n\\caption{Contours of constant $R_{h\\to\\mu^+\\mu^-}$ in the $\\Delta a_{\\mu}$ -- $d_{\\mu}$ plane in models with $k=64\\pi^2$ (e.g. SM+VL, $\\mathcal{Q}=1$) (top); $k=64\\pi^2, \\;64\\pi^2\/3$, and $64\\pi^2\/5$ (e.g. SM+VL, $\\mathcal{Q}=1$, 3, and 5) (middle); and for smaller values of $k$ relevant for models with extended Higgs sectors and loop models (bottom). The light and dark green shaded regions show the $\\pm 1\\sigma$ and $\\pm 2\\sigma$ ranges of $\\Delta a_{\\mu}$, respectively.}\n\\label{fig:SM_ellipse}\n\\end{figure}\n\n\nConcretely, in five possible extensions of the SM with vectorlike leptons that can generate chirally enhanced contributions, $k$ is completely determined by the quantum numbers of new leptons,\n\\begin{equation}\nk=\\frac{64\\pi^{2}}{\\mathcal{Q}},\n\\label{eq:tree_X_SM}\n\\end{equation}\nwhere $\\mathcal{Q}= 1$ for $X$ and $Y$ leptons in $\\mathbf{2}_{-1\/2}\\oplus\\mathbf{1}_{-1}$ or $\\mathbf{2}_{-1\/2}\\oplus\\;\\mathbf{3}_{0}$ representations of $SU(2)\\times U(1)_Y$; $\\mathcal{Q}=3$ for $\\mathbf{2}_{-3\/2}\\oplus\\mathbf{1}_{-1}$ or $\\mathbf{2}_{-3\/2}\\oplus\\mathbf{3}_{-1}$; and $\\mathcal{Q}=5$ for $\\mathbf{2}_{-1\/2}\\oplus\\mathbf{3}_{-1}$~\\cite{Kannike:2011ng}. \n\n\nIn Fig.~\\ref{fig:SM_ellipse} (top), we show contours of constant $R_{h\\to \\mu^+\\mu^-}$ in the plane of the muon dipole moments for $k=64\\pi^2$ which corresponds, for example, to the SM extended by a vectorlike doublet and singlet leptons whose quantum numbers mirror their respective SM counterparts, i.e. $\\mathcal{Q}=1$. The region where $h\\to \\mu^{+}\\mu^{-}$ is found to be within $10\\%$ of the SM value, indicating the ultimate LHC precision, is shaded red. The region outside $R_{h\\to \\mu^+\\mu^-}=2.2$ (shaded gray) is already ruled out by measurements of $h\\to \\mu^{+}\\mu^{-}$~\\cite{ATLAS:2020fzp}. This model (range of $k$) is somewhat special as, in spite of the large contribution from $C_{\\mu H}$ to the muon mass and Yukawa coupling, the SM-like $R_{h\\to \\mu^+\\mu^-}$ and $d_{\\mu} = 0$ are consistent with $\\Delta a_{\\mu}$ within $1\\sigma$.\\footnote{ This illustrates the only exception to generating non-zero $\\mu$EDM when $R_{h\\to \\mu^+\\mu^-}=1$, advertised in the introduction. It corresponds to the case when $\\lambda_{\\mu\\mu}^{h} = -m_\\mu\/v$.}\nNote however, that the current central value of $\\Delta a_{\\mu}$ requires $R_{h\\to \\mu^+\\mu^-} = 1.32$ for $d_{\\mu}=0$ and it can be as large as the current upper limit when $|d_{\\mu}|\\sim 1\\times 10^{-22}\\, {\\rm e\\cdot cm}$. \n\nThe situation is dramatically different for the other two scenarios, $\\mathcal{Q} = 3$ and 5, with the comparison of all three scenarios shown in Fig.~\\ref{fig:SM_ellipse} (middle). As $k$ decreases, the center of the ellipse moves to larger values of $\\Delta a_{\\mu}$. Contours of $R_{\\mu}= 1\\pm 10\\%$ are now consistent with the whole $2\\sigma$ range of $\\Delta a_{\\mu}^{exp}$. \n However, in contrast to the case with $\\mathcal{Q}=1$, consistency of $R_{\\mu}= 1\\pm 10\\%$ with $\\Delta a_{\\mu}$ necessarily implies a nonzero value of $d_{\\mu}$. In fact, the consistency sharply requires values of $d_{\\mu}\\simeq 2.7-3.4\\times10^{-22} \\,{\\rm e\\cdot cm}$ ($\\mathcal{Q}=3$) and $d_{\\mu}\\simeq 3.6-5.1\\times10^{-22} \\,{\\rm e\\cdot cm}$ ($\\mathcal{Q}=5$), which are within the expected sensitivity of future measurements. Thus, for these scenarios, the correlation of three observables requires deviations from SM predictions either in $R_{\\mu}$ or $d_{\\mu}$ that are observable in near future. \n\n\n\nModels where the SM Higgs acts as only a single component of an extended Higgs sector participating in EWSB, such as in a 2HDM, also fall into the class of tree models. However, the mixing in the extended Higgs sector will generically introduce an additional free parameter. In the case of a 2HDM type-II, it is the ratio of vacuum expectation values of the two Higgs doublets, $\\tan\\beta$. From the results of Refs.~\\cite{Dermisek:2021ajd,Dermisek:2021mhi} we can find that the modification to Eq.~\\ref{eq:tree_X_SM}, assuming a common mass for all new particles, becomes\n\\begin{equation}\nk=\\frac{64\\pi^{2}}{\\mathcal{Q}(1+\\tan^{2}\\beta)},\n\\label{eq:tree_X_2HDM}\n\\end{equation}\nwhich remains a very good approximation for arbitrary splitting between the masses of new leptons and similar or smaller Higgs masses compared to masses of new leptons.\n For low $\\tan\\beta$ the results are similar as for the SM extensions with VLs discussed above. However, as $\\tan\\beta$ increases, much smaller $k$ values are possible. Contours of constant $R_{h\\to \\mu^+\\mu^-} = 1$ for a few representative choices of smaller $k$ are shown in Fig.~\\ref{fig:SM_ellipse} (bottom). We also show corresponding $\\pm 10\\%$ and $\\pm 1\\%$ regions for cases when the region does not extend all the way to $d_{\\mu} = 0$ in the $1\\sigma$ range of $\\Delta a_{\\mu}$. For the 2HDM type-II extended with vectorlike leptons with the same quantum numbers as SM leptons, $\\mathcal{Q}=1$, the plotted values of $k$ correspond to $ \\tan \\beta \\simeq 5, 8, 14, 18$ and 25; while the 3 cases in the middle plot correspond to $ \\tan \\beta \\simeq 0, 1.4$ and 2 (with the first case not being physical).\n \n \n %\n\n\nThe loop models with two new fermions and 1 scalar (FFS) or one new fermion and 2 scalars (SSF) represent infinite classes of models as the required couplings alone do not completely determine the quantum numbers of new particles. In this case the $k$ factor is directly linked to the coupling responsible for the chiral enhancement, $\\lambda_{YZ}$, see Fig.~\\ref{fig:diags}. For the FFS models and, in the limit of a common mass of all new particles, we find\n\\begin{equation}\nk=\\frac{4}{\\mathcal{Q}}|\\lambda_{YZ}|^{2}.\n\\label{eq:loop_Q}\n\\end{equation}\nFor SSF models the $Y-Z-H$ coupling $A_{YZ}$ is dimensionful and in the above formula $|\\lambda_{YZ}|^2$ should be replaced by $|A_{YZ}|^{2}\/M^{2}$ where $M$ is the mass of new particles. The $\\mathcal{Q}$ factor is determined by the charges of new particles, and it can be obtained, for example, from the entries in Tables~1 and 2 of Ref.~\\cite{Crivellin:2021rbq}. We find that for hypercharge choices $\\pm 1\/2$ and $\\pm 1$ of the scalar in FFS models or fermion in SSF models, $|\\mathcal{Q}|$ varies between 1\/5 and 6. For small $\\mathcal{Q}$ and large $\\lambda_{YZ}$, $k$ can be as large as in the tree models, the SM+VL or 2HDM type-II at small $ \\tan \\beta$, while for larger $\\mathcal{Q}$ and\/or small $\\lambda_{YZ}$ the range of $k$ coincides with predictions of 2HDM type-II at larger $ \\tan \\beta$. For example, for $\\mathcal{Q}= 1$, the range of $\\lambda_{YZ}$ from $0.5$ to $\\sqrt{4\\pi}$ corresponds to $k = 1$ to $\\simeq 50$.\n\n\nFrom Fig.~\\ref{fig:SM_ellipse} we see that as $k$ is decreasing from the values typical for SM+VLs, the consistency of $\\Delta a_{\\mu}$ with $R_{h\\to \\mu^+\\mu^-} = 1\\pm 10\\%$ requires larger $|d_{\\mu}|$. However, the range of predicted $|d_{\\mu}|$ is also growing, and at some point, for $k \\lesssim 20$, it extends to $d_{\\mu} = 0$. Further decreasing $k$ to about 2, even the $R_{h\\to \\mu^+\\mu^-} = 1 \\pm 1\\%$ range extends to $d_{\\mu} = 0$. These findings are also clearly visible in Fig.~\\ref{fig:edm_vs_k}, where we plot these contours of $R_{h\\to \\mu^+\\mu^-}$ in the $k$ -- $|d_{\\mu}|$ plane. \n\n\\begin{figure}[t]\n\\includegraphics[width=0.75\\linewidth]{edm_vs_k.pdf} \n\\caption{Future exclusion regions in the $k$ -- $|d_{\\mu}|$ plane assuming $R_{h\\to \\mu^+\\mu^-}$ is measured to be SM-like, $R_{h\\to \\mu^+\\mu^-} = 1\\pm0.1$ (red) and $R_{h\\to \\mu^+\\mu^-} = 1\\pm0.01$ (blue) assuming $\\Delta a_{\\mu}$ within $1\\sigma$ of the measured value. The regions would extend to the solid lines with the same color if the central value of $\\Delta a_{\\mu}$ was assumed. The green line (shaded region) corresponds to $R_{h\\to \\mu^+\\mu^-} = 1$ assuming the central value ($1\\sigma$ range) of $\\Delta a_{\\mu}$.}\n\\label{fig:edm_vs_k}\n\\end{figure}\n\nFinally, allowing for any $R_{h\\to \\mu^+\\mu^-}$ as a future possible measured value (up to the current limit), in Fig.~\\ref{fig:k} we plot contours of $k$ in the $R_{h\\to \\mu^+\\mu^-}$ -- $|d_{\\mu}|$ plane assuming the central value $\\Delta a_{\\mu}$.\nNote that there are two values of $k$ resulting in the same $R_{h\\to \\mu^+\\mu^-}$ and $|d_{\\mu}|$ except for the boundary of the shaded region. The boundary corresponds to the upper limit on possible $\\mu$EDM if $R_{h\\to \\mu^+\\mu^-} < 1$,\n\\begin{equation}\n|d_{\\mu}| \\leq \\frac{e \\,\\Delta a_{\\mu}}{2m_\\mu}\\sqrt{\\frac{R_{h\\to \\mu^+\\mu^-}}{1-R_{h\\to \\mu^+\\mu^-}}}.\n\\end{equation}\nNote that models with small $k$ can generate $d_{\\mu}$ up to the current experimental upper limit, $|d_{\\mu}|=1.8\\times 10^{-19}\\;{\\rm e\\cdot cm}$~\\cite{Muong-2:2008ebm}.\n\\begin{figure}[t]\n\\includegraphics[width=0.6\\linewidth]{k_contours_combined_v5.pdf} \n\\caption{Contours of constant $k$ in the $R_{h\\to\\mu\\mu}$ -- $|d_{\\mu}|$ plane assuming the central value $\\Delta a_{\\mu}$.}\n\\label{fig:k}\n\\end{figure}\n\n\n\n\\noindent\n{\\it Discussion and conclusions.} \nWe have seen that every model with chirally-enhanced contributions to $\\Delta a_{\\mu}$ can be parametrized by the $k$ factor that relates the dipole operator to the contribution to the muon mass and thus specifies the correlation between $\\Delta a_{\\mu}$, $d_{\\mu}$ and $R_{h\\to \\mu^+\\mu^-}$. In the SM with VLs the $k$ factor is fully fixed by quantum numbers; in similar models with extended Higgs sectors a mixing parameter will enter $k$, for example $\\tan\\beta$ in the 2HDM; and in loop models $k$ is directly related to the coupling responsible for chiral enhancement. Through this correlation large classes of models or vast ranges of model parameters can be efficiently tested.\n\nThe $R_{h\\to \\mu^+\\mu^-}$ is expected to be measured with $\\sim10\\%$ precision at the LHC and $\\sim 1\\%$ at the hadron version of the Future Circular Collider~\\cite{Abada:2019lih}. The limits on $\\mu$EDM are expected to reach $|d_{\\mu}|\\sim 1\\times 10^{-21}\\,{\\rm e\\cdot cm}$ at the Muon g-2 experiment at Fermilab~\\cite{Chislett:2016jau}, and could reach $6\\times 10^{-23}\\,{\\rm e\\cdot cm}$ at the Paul Scherrer Institute~\\cite{Adelmann:2021udj}. Thus near future measurements have the potential to reduce the number of SM extensions with vectorlike leptons to one specific $\\mathcal{Q}$, or rule out all of them, irrespectively of the scale of new physics or the size of couplings.\nFor 2HDM type-II, already the LHC measurement of $R_{h\\to \\mu^+\\mu^-}$ will limit $\\tan\\beta$ to $\\gtrsim 6$, and for loop models, it will limit the size of the coupling resulting in chiral enhancement, again irrespectively on other details of the model. This immediately sets the upper bound for the scale of new physics to $\\sim 18$ TeV for the 2HDM~\\cite{Dermisek:2020cod, Dermisek:2021ajd} and, for example, $\\sim14$ TeV for FFS loop models with $SU(2)$ doublets and singlets and $\\mathcal{Q} =1$. Improving the measurement of $R_{h\\to \\mu^+\\mu^-}$ to within $1\\%$ will further reduce these upper limits to $\\sim 10$ TeV and $\\sim 8$ TeV respectively. Similar reasoning can be used to obtain an upper limit on the lightest new particle in any given scenario.\nThus the correlation between $\\Delta a_{\\mu}$, $d_{\\mu}$ and $R_{h\\to \\mu^+\\mu^-}$ can test most efficiently the high end of the spectrum that is far beyond the reach of currently envisioned future colliders.\n\n\nThe discussion in this letter has been limited to couplings necessary to generate a chirally-enhanced contribution to $\\Delta a_{\\mu}$. Effects of other possible dimension 6 operators involving muon fields, SM Higgs doublet and derivatives can be absorbed into the definition of the muon Yukawa coupling, $y_\\mu$, or are parametrically suppressed by $m_\\mu\/v$, similar as in the discussion in Ref.~\\cite{Dermisek:2021mhi}. However additional couplings in a given model, not contributing to $\\Delta a_{\\mu}$ might in principle enter the formula for $k$ (or even generate a complex $k$ parameter), for example scalar quartic couplings involving new scalars and the SM Higgs doublet~\\cite{Thalapillil:2014kya,Crivellin:2021rbq}. In such cases $R_{h\\to \\mu^+\\mu^-}$ still carves an ellipse in the plane of dipole moments but with the center shifted (to non-zero $d_{\\mu}$ for complex $k$) depending on the size of additional couplings. Furthermore, in certain models there can be sizable contributions to $\\Delta a_{\\mu}$ from other operators due to renormalization group mixing, for example from four-fermion operators in models with leptoquarks~\\cite{Gherardi:2020det,Aebischer:2021uvt}. However, the couplings required also necessarily generates $C_{\\mu H}$ with the same phase resulting in a shift of $k$ by a real number. These effects, together with the general study of a complete set of dimension 6 operators, will be discussed elsewhere~\\cite{Dermisek}.\n\n\n\n\n\\vspace{0.3cm}\n\\acknowledgments\nThe work of R.D. was supported in part by the U.S. Department of Energy under Award No. {DE}-SC0010120. TRIUMF receives federal funding via a contribution agreement with the National Research Council of Canada.\n\n\n\n\n\n\n\n\n\n\n\n\\vspace{0.05cm}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction.}\n\n${\\rm CAT}(0)$ cube complexes provide an ideal setting to study non-positive curvature in a discrete context. On the one hand, their geometry is sufficiently rich to ensure that large classes of groups admit interesting actions on them. Right-angled Artin groups, hyperbolic or right-angled Coxeter groups, hyperbolic $3$-manifold groups, random groups at sufficiently low density all act geometrically on ${\\rm CAT}(0)$ cube complexes \\cite{Niblo-Reeves, Bergeron-Wise, Ollivier-Wise}, to name just a few examples. Moreover, every finitely generated group with a codimension one subgroup admits an action on a ${\\rm CAT}(0)$ cube complex with unbounded orbits \\cite{Sageev,Gerasimov,Niblo-Roller}.\n\nOn the other hand, the geometry of finite dimensional ${\\rm CAT}(0)$ cube complexes is much better understood than general ${\\rm CAT}(0)$ geometry, even with no local compactness assumption. For instance, groups acting properly on finite dimensional ${\\rm CAT}(0)$ cube complexes are known to have finite asymptotic dimension \\cite{Wright}, to satisfy the Von Neumann-Day dichotomy and, if torsion-free, even the Tits alternative \\cite{Sageev-Wise, CS}. It is not known whether the same are true for general ${\\rm CAT}(0)$ groups.\n\nThree features are particularly relevant in the study of ${\\rm CAT}(0)$ cube complexes. First of all, they are endowed with a metric of non-positive curvature. Secondly, the $1$-skeleton becomes a median graph when endowed with its intrinsic path-metric; this means that, for any three vertices, there exists a unique vertex that lies between any two of them. This property is closely related to the existence of hyperplanes and allows for a combinatorial approach that is not available in general ${\\rm CAT}(0)$ spaces. Finally, cube complexes are essentially discrete objects, in that their geometry is fully encoded by the $0$-skeleton. In particular, the automorphism group of a cube complex is totally disconnected.\n\nIt is natural to wonder how much in the theory of ${\\rm CAT}(0)$ cube complexes can be extended to those spaces that share the second feature: \\emph{median spaces}. These provide a simultaneous generalisation of ${\\rm CAT}(0)$ cube complexes and real trees; for an introduction, see e.g.~\\cite{Nica-thesis, CDH, Bow4} and references therein. The class of median spaces is closed under ultralimits and also includes all $L^1$ spaces, so certain pathologies are bound to arise in this context.\n\nThe notion of \\emph{rank} of a median space was introduced in \\cite{Bow1}; for ${\\rm CAT}(0)$ cube complexes it coincides with the usual concept of dimension. It was recently shown that connected, finite rank median spaces are also endowed with a \\emph{canonical} ${\\rm CAT}(0)$ metric \\cite{Bow4}. Thus it seems that, in finite rank, the only true difference between ${\\rm CAT}(0)$ cube complexes and general median spaces lies in the discreteness of the former. Most of the results of the present paper support this analogy.\n\nWe will restrict our attention to \\emph{finite rank} median spaces; this is essential when considering the Tits alternative, as every amenable group admits a proper action on an infinite rank median space \\cite{Cherix-Martin-Valette,CDH}. Nontrivial examples of finite rank median spaces arise, for instance, from asymptotic cones of coarse median spaces \\cite{Bow1,Zeidler}. The Cayley graphs of many interesting groups are coarse median: hyperbolic groups, cubulated groups \\cite{Hagen-Susse}, fundamental groups of closed irreducible 3-manifolds not modelled on Nil or Sol, mapping class groups \\cite{Behrstock-Minsky,Behrstock-Drutu-Sapir, Behrstock-Drutu-Sapir2} and, more generally, all groups that are HHS \\cite{Bow3,HHS,HHS2}.\n\nOur main result is the following version of the Tits alternative:\n\n\\begin{thmA}\nLet $X$ be a complete, finite rank median space with an isometric action $\\Gamma\\curvearrowright X$. Suppose that $\\Gamma$ has no nonabelian free subgroups.\n\\begin{itemize}\n\\item If the action is free, $\\Gamma$ is virtually finite-by-abelian. If moreover $X$ is connected or $\\Gamma$ is finitely generated, then $\\Gamma$ is virtually abelian.\n\\item If the action is (metrically) proper, $\\Gamma$ is virtually (locally finite)-by-abelian.\n\\item If all point stabilisers are amenable, $\\Gamma$ is amenable.\n\\end{itemize}\n\\end{thmA}\n\nWe remark that every countable, locally finite group admits a proper action on a simplicial tree, see Example~II.7.11 in \\cite{BH}. \n\nA discrete group $\\Gamma$ has the Haagerup property if and only if it admits a proper action on a median space \\cite{Cherix-Martin-Valette,CDH}. However, Theorem~A shows that $\\Gamma$ needs not have a proper (or free) action on a \\emph{finite rank} median space; for instance, it suffices to consider any torsion-free amenable group that is not virtually abelian. \n\nIn fact, there even exist groups $\\Gamma$ with the Haagerup property, such that every action of $\\Gamma$ on a complete, finite rank median space has a global fixed point; a simple example is provided by irreducible lattices in $SL_2\\mathbb{R}\\times SL_2\\mathbb{R}$ \\cite{Fioravanti3}.\n\nOur proof of Theorem~A follows the same broad outline as the corresponding result for ${\\rm CAT}(0)$ cube complexes, as it appears in \\cite{CS,CFI}. Given an action $\\Gamma\\curvearrowright X$, either $\\Gamma$ has a finite orbit within a suitable compactification of $X$, or the space $X$ exhibits a certain tree-like behaviour. In the former case, one obtains a ``big'' abelian quotient of $\\Gamma$; in the latter, one can construct many nonabelian free subgroups with a ping-pong argument.\n\nWe remark that the first proof of the Tits alternative for ${\\rm CAT}(0)$ cube complexes was due to M.~Sageev and D.~T.~Wise \\cite{Sageev-Wise} and follows a completely different strategy. It relies on the Algebraic Torus Theorem \\cite{Dunwoody-Swenson} and a key fact is that, when a group $\\Gamma$ acts nontrivially on a ${\\rm CAT}(0)$ cube complex, some hyperplane stabiliser is a codimension one subgroup of $\\Gamma$. Unfortunately, this approach is bound to fail when dealing with median spaces: there is an analogous notion of ``hyperplane'' (see Section~\\ref{prelims}), but all hyperplane stabilisers could be trivial, even if the group $\\Gamma$ is one-ended. This happens for instance when a surface group acts freely on a real tree \\cite{Morgan-Shalen}.\n\nMany of the techniques of \\cite{CS} have proven extremely useful in the study of ${\\rm CAT}(0)$ cube complexes, for instance in \\cite{Nevo-Sageev,Fernos,CFI,Kar-Sageev,Kar-Sageev2} to name just a few examples. We extend some of this machinery to median spaces, in particular what goes by the name of ``flipping'', ``skewering'' and ``strong separation''; see Theorems~B and~D below. We will exploit these results in \\cite{Fioravanti3} to obtain a superrigidity result analogous to the one in \\cite{CFI}.\n\nTo state the rest of the results of the present paper, we need to introduce some terminology. In \\cite{Fioravanti1} we defined a compactification $\\overline X$ of a complete, finite rank median space $X$. We refer to it as the \\emph{Roller compactification} of $X$; for ${\\rm CAT}(0)$ cube complexes, it consists precisely of the union of $X$ and its Roller boundary $\\partial X$, in the usual sense (see \\cite{BCGNW, Nevo-Sageev} for a definition). \n\nRoller compactifications of general median spaces strongly resemble Roller compactifications of cube complexes. For instance, the space $\\overline X$ has a natural structure of median algebra and $\\partial X$ is partitioned as a union of median spaces (``components'' in our terminology), whose rank is strictly lower than that of $X$. These properties will be essential when extending the machinery of \\cite{CS} to finite rank median spaces. For ${\\rm CAT}(0)$ cube complexes, our approach is slightly different from that of \\cite{CS}, in that we work with Roller boundaries rather than visual boundaries.\n\nWe say that an isometric action $\\Gamma\\curvearrowright X$ is \\emph{Roller elementary} if $\\Gamma$ has at least one finite orbit in $\\overline X$. An action $\\Gamma\\curvearrowright X$ is \\emph{Roller minimal} if $\\Gamma$ leaves invariant no proper, closed, convex subset of $\\overline X$ and $X$ is not a single point; for the notion of convexity in the median algebra $\\overline X$, see Section~\\ref{prelims}. In ${\\rm CAT}(0)$ cube complexes, Roller minimal actions are precisely essential actions (in the terminology of \\cite{CS}) with no fixed point in the visual boundary.\n\nLike ${\\rm CAT}(0)$ cube complexes, median spaces are endowed with a canonical collection of halfspaces $\\mathscr{H}$. We say that $\\Gamma\\curvearrowright X$ is \\emph{without wall inversions} if there exists no $g\\in\\Gamma$ such that $g\\mathfrak{h}=\\mathfrak{h}^*$ for some $\\mathfrak{h}\\in\\mathscr{H}$. Here $\\mathfrak{h}^*$ denotes the complement $X\\setminus\\mathfrak{h}$ of the halfspace $\\mathfrak{h}$. Actions without wall inversions are a generalisation of actions on $0$-skeleta of simplicial trees without edge inversions. We remark that, perhaps counterintuitively, every action on a \\emph{connected} median space is automatically without wall inversions (see Proposition~\\ref{all about halfspaces} below); this includes all actions on real trees.\n\nWe have the following analogue of the Flipping and Double Skewering Lemmata from \\cite{CS}.\n\n\\begin{thmB}\nLet $X$ be a complete, finite rank median space with a Roller minimal action $\\Gamma\\curvearrowright X$ without wall inversions.\n\\begin{itemize}\n\\item For ``almost every'' halfspace $\\mathfrak{h}$, there exists $g\\in\\Gamma$ with $\\mathfrak{h}^*\\subsetneq g\\mathfrak{h}$ and $d(g\\mathfrak{h}^*,\\mathfrak{h}^*)>0$.\n\\item For ``almost all'' halfspaces $\\mathfrak{h},\\mathfrak{k}$ with $\\mathfrak{h}\\subseteq\\mathfrak{k}$ there exists $g\\in\\Gamma$ with $g\\mathfrak{k}\\subsetneq\\mathfrak{h}\\subseteq\\mathfrak{k}$ and $d(g\\mathfrak{k}, \\mathfrak{h}^*)>0$.\n\\end{itemize}\n\\end{thmB}\n\nPositivity of distances is automatic in cube complexes, but not in general median spaces. Theorem~B cannot be proved for \\emph{all} halfspaces; counterexamples already appear in real trees, see Section~\\ref{CS-like machinery}. The notion of ``almost every'' should be understood with respect to a certain measure on $\\mathscr{H}$; see Section~\\ref{prelims} below for a definition.\n\nFor every complete, finite rank median space $X$, we can define a \\emph{barycentric subdivision} $X'$; we study these in Section~\\ref{splitting the atom}. The space $X'$ is again complete and median of the same rank. There is a canonical isometric embedding $X\\hookrightarrow X'$ and every action on $X$ extends to an action without wall inversions on $X'$. Thus, the assumption that $\\Gamma\\curvearrowright X$ be without wall inversions in Theorem~B is not restrictive. \n\nRoller minimality may seem a strong requirement, but the structure of Roller compactifications makes Roller minimal actions easy to come by:\n\n\\begin{propC}\nLet $X$ be a complete, finite rank median space with an isometric action $\\Gamma\\curvearrowright X$. If $\\Gamma$ fixes no point of $\\overline X$, there exists a $\\Gamma$-invariant component $Z\\subseteq\\overline X$ and a closed, convex, $\\Gamma$-invariant subset $C\\subseteq Z$ such that the action $\\Gamma\\curvearrowright C$ is Roller minimal.\n\\end{propC}\n\nWe remark that actions with a global fixed point in $\\overline X$ have a very specific structure, see Theorem~F below.\n\nTheorem~B allows us to construct free groups of isometries, as soon as we have ``tree-like'' configurations of halfspaces inside the median space $X$. More precisely, we need \\emph{strongly separated} pairs of halfspaces; in the case of ${\\rm CAT}(0)$ cube complexes, these were introduced in \\cite{Behrstock-Charney} and used in \\cite{CS} to characterise irreducibility. We prove:\n\n\\begin{thmD}\nLet $X$ be a complete, finite rank median space admitting a Roller minimal action $\\Gamma\\curvearrowright X$ without wall inversions. The median space splits as a nontrivial product if and only if no two halfspaces are strongly separated.\n\\end{thmD}\n\nFollowing well-established techniques \\cite{CS}, Theorems~B and~D yield:\n\n\\begin{thmE}\nLet $X$ be a complete, finite rank median space with an isometric action $\\Gamma\\curvearrowright X$. Either $\\Gamma$ contains a nonabelian free subgroup or the action is Roller elementary.\n\\end{thmE}\n\nThe last step in the proof of Theorem~A consists in the study of Roller elementary actions; we employ the same strategy as the appendix to \\cite{CFI}. To this end, we need to extend the notion of \\emph{unidirectional boundary set (UBS)} to median spaces. \n\nIn ${\\rm CAT}(0)$ cube complexes, UBS's were introduced in \\cite{Hagen}. Up to a certain equivalence relation, they define the simplices in Hagen's simplicial boundary and provide a useful tool to understand Tits boundaries, splittings and divergence \\cite{Hagen, Behrstock-Hagen}. They can be thought of as a generalisation of embedded cubical orthants. \n\nWe introduce UBS's in median spaces and use them to prove the following result. A more careful study of UBS's will be carried out in \\cite{Fioravanti3}, where we show that Roller elementarity is equivalent to the vanishing of a certain cohomology class.\n\n\\begin{thmF}\nLet $X$ be complete and finite rank. Suppose that $\\Gamma\\curvearrowright X$ fixes a point in the Roller boundary of $X$. A finite-index subgroup $\\Gamma_0\\leq\\Gamma$ fits in an exact sequence\n\\[1\\longrightarrow N\\longrightarrow \\Gamma_0 \\longrightarrow\\mathbb{R}^r,\\]\nwhere $r=\\text{rank}(X)$ and every finitely generated subgroup of $N$ has an orbit in $X$ with at most $2^r$ elements. If $X$ is connected, every finitely generated subgroup of $N$ fixes a point.\n\\end{thmF}\n\n{\\bf Structure of the paper.} In Section~\\ref{preliminaries} we review the basic theory of median spaces and median algebras, with a special focus on the results of \\cite{Fioravanti1}. We use halfspaces to characterise when a median space splits as a nontrivial product. We study barycentric subdivisions and a similar construction that allows us to canonically embed general median spaces into connected ones. Section~\\ref{elliptic isometries} is concerned with groups of elliptic isometries. In Section~\\ref{stab xi} we study UBS's and prove Theorem~F. In Section~\\ref{CS-like machinery} we introduce Roller elementarity and Roller minimality; we prove Proposition~C and Theorems~A,~B and~D. Finally, Section~\\ref{facing triples} is devoted to constructing free subgroups of isometry groups; we prove Theorem~E there.\n\n{\\bf Acknowledgements.} The author warmly thanks Brian Bowditch, Pier\\-re-Emmanuel Caprace, Indira Chatterji, Thomas Delzant, Cornelia Dru\\c tu, Talia Fern\\'os, Mark Hagen for many helpful conversations and Anthony Genevois for his comments on an earlier version. The author expresses special gratitude to Cornelia Dru\\c tu for her excellent supervision and to Talia Fern\\'os for her encouragement to pursue this project. \n\nThis work was undertaken at the Mathematical Sciences Research Institute in Berkeley during the Fall 2016 program in Geometric Group Theory, where the author was supported by the National Science Foundation under Grant no.~DMS-1440140 and by the GEAR Network. Part of this work was also carried out at the Isaac Newton Institute for Mathematical Sciences, Cambridge, during the programme ``Non-positive curvature, group actions and cohomology'' and was supported by EPSRC grant no.~EP\/K032208\/1. The author was also supported by the Clarendon Fund and the Merton Moussouris Scholarship.\n\n\n\\section{Preliminaries.}\\label{preliminaries}\n\n\\subsection{Median spaces and median algebras.}\\label{prelims}\n\nLet $X$ be a metric space. A finite sequence of points $(x_k)_{1\\leq k\\leq n}$ is a \\emph{geodesic} if $d(x_1,x_n)=d(x_1,x_2)+...+d(x_{n-1},x_n)$. The interval $I(x,y)$ between $x,y\\in X$ is the set of points lying on a geodesic from $x$ to $y$. We say that $X$ is a \\emph{median space} if, for all $x,y,z\\in X$, the intersection $I(x,y)\\cap I(y,z)\\cap I(z,x)$ consists of a single point, which we denote by $m(x,y,z)$. In this case, the map $m\\colon X^3\\rightarrow X$ endows $X$ with a structure of \\emph{median algebra}, see e.g.~\\cite{CDH, Bow1, Roller} for a definition and various results.\n\nIn a median algebra $(M,m)$, the \\emph{interval} $I(x,y)$ between $x,y\\in M$ is the set of points $z\\in M$ with $m(x,y,z)=z$; this is equivalent to the definition above if $M$ arises from a median space. A subset $C\\subseteq M$ is \\emph{convex} if $I(x,y)\\subseteq C$ whenever $x,y\\in C$. Every collection of pairwise-intersecting convex subsets of a median algebra has the finite intersection property; this is Helly's Theorem, see e.g.~Theorem~2.2 in \\cite{Roller}.\n\nA \\emph{halfspace} is a convex subset $\\mathfrak{h}\\subseteq M$ whose complement $\\mathfrak{h}^*:=M\\setminus\\mathfrak{h}$ is also convex. We will refer to the unordered pair $\\mathfrak{w}:=\\{\\mathfrak{h},\\mathfrak{h}^*\\}$ as a \\emph{wall}; we say that $\\mathfrak{h}$ and $\\mathfrak{h}^*$ are the \\emph{sides} of $\\mathfrak{w}$. The wall $\\mathfrak{w}$ separates subsets $A\\subseteq M$ and $B\\subseteq M$ if $A\\subseteq\\mathfrak{h}$ and $B\\subseteq\\mathfrak{h}^*$ or vice versa. The wall $\\mathfrak{w}$ is \\emph{contained} in a halfspace $\\mathfrak{k}$ if $\\mathfrak{h}\\subseteq\\mathfrak{k}$ or $\\mathfrak{h}^*\\subseteq\\mathfrak{k}$; we say, with a slight abuse of terminology, that $\\mathfrak{w}$ is contained in $\\mathfrak{k}_1\\cap...\\cap\\mathfrak{k}_k$ if $\\mathfrak{w}$ is contained in $\\mathfrak{k}_i$ for each $i$.\n\nThe sets of halfspaces and walls of $M$ are denoted $\\mathscr{H}(M)$ and $\\mathscr{W}(M)$ respectively, or simply $\\mathscr{H}$ and $\\mathscr{W}$. Given subsets $A,B\\subseteq M$, we write $\\mathscr{H}(A|B)$ for the set of halfspaces with $B\\subseteq\\mathfrak{h}$ and $A\\subseteq\\mathfrak{h}^*$ and we set $\\sigma_A:=\\mathscr{H}(\\emptyset|A)$; we will not distinguish between $x\\in M$ and the singleton $\\{x\\}$. If $A,B$ are convex and disjoint, we have $\\mathscr{H}(A|B)\\neq\\emptyset$, see e.g.~Theorem~2.7 in \\cite{Roller}; we will refer to the sets $\\mathscr{H}(x|y)$, $x,y\\in M$, as \\emph{halfspace-intervals}.\n\nA \\emph{pocset} is a poset equipped with an order-reversing involution $*$ such that every element $a$ is incomparable with $a^*$. Ordering $\\mathscr{H}$ by inclusion, we obtain a pocset where the involution is given by taking complements. If $E\\subseteq\\mathscr{H}$, we write $E^*:=\\{\\mathfrak{h}^*\\mid\\mathfrak{h}\\in E\\}$. We say that $\\mathfrak{h},\\mathfrak{k}\\in\\mathscr{H}$ are \\emph{transverse} if any two elements in the set $\\{\\mathfrak{h},\\mathfrak{h}^*,\\mathfrak{k},\\mathfrak{k}^*\\}$ are incomparable; equivalently, the intersections $\\mathfrak{h}\\cap\\mathfrak{k}$, $\\mathfrak{h}\\cap\\mathfrak{k}^*$, $\\mathfrak{h}^*\\cap\\mathfrak{k}$, $\\mathfrak{h}^*\\cap\\mathfrak{k}^*$ are all nonempty subsets of $M$. Two walls are transverse if they arise from transverse halfspaces. \n\nMaximal subsets of $\\mathscr{H}$ consisting of pairwise-intersecting halfspaces are termed \\emph{ultrafilters}; a set of pairwise-intersecting halfspaces is an ultrafilter if and only if it contains a side of every wall of $M$. For every $x\\in M$, the subset $\\sigma_x\\subseteq\\mathscr{H}$ is an ultrafilter. A subset $\\Omega\\subseteq\\mathscr{H}$ is said to be \\emph{inseparable} if it contains all $\\mathfrak{j}\\in\\mathscr{H}$ such that $\\mathfrak{h}\\subseteq\\mathfrak{j}\\subseteq\\mathfrak{k}$, for $\\mathfrak{h},\\mathfrak{k}\\in\\Omega$. The \\emph{inseparable closure} of a subset $\\Omega\\subseteq\\mathscr{H}$ is the smallest inseparable set containing $\\Omega$; it coincides the union of the sets $\\mathscr{H}(\\mathfrak{k}^*|\\mathfrak{h})$ as $\\mathfrak{h},\\mathfrak{k}$ vary in $\\Omega$.\n\nThe set $\\{-1,1\\}$ has a unique structure of median algebra. Considering its median map separately in all coordinates, we endow $\\{-1,1\\}^k$ with a median-algebra structure for each $k\\in\\mathbb{N}$; we will refer to it as a \\emph{$k$-hypercube}. The \\emph{rank} of $M$ is the maximal $k\\in\\mathbb{N}$ such that we can embed a $k$-hypercube into $M$. By Proposition~6.2 in \\cite{Bow1} this is the same as the maximal cardinality of a set of pairwise-transverse halfspaces. Note that $M$ has rank zero if and only if it consists of a single point. The following is immediate from Ramsey's Theorem \\cite{Ramsey}:\n\n\\begin{lem}\\label{Ramsey}\nIf $M$ has finite rank and $\\sigma_1,\\sigma_2\\subseteq\\mathscr{H}$ are two ultrafilters, every infinite subset of $\\sigma_1\\setminus\\sigma_2$ contains an infinite subset that is totally ordered by inclusion.\n\\end{lem}\n\nIf $C\\subseteq M$ and $x\\in M$, we say that $y\\in C$ is a \\emph{gate} for $(x,C)$ if $y\\in I(x,z)$ for all $z\\in C$. The set $C$ is \\emph{gate-convex} if a gate exists for every point of $M$; in this case, gates are unique and define a \\emph{gate-projection} $\\pi_C\\colon M\\rightarrow C$. If $C$ is gate-convex, we have $\\mathscr{H}(x|\\pi_C(x))=\\mathscr{H}(x|C)$ for every $x\\in M$. Every interval $I(x,y)$ is gate-convex with projection $z\\mapsto m(x,y,z)$. Gate-convex sets are always convex, but the converse does not hold in general. We record a few more properties of gate-convex subsets in the following result; see \\cite{Fioravanti1} for proofs.\n\n\\begin{prop}\\label{all about gates}\nLet $C,C'\\subseteq M$ be gate-convex.\n\\begin{enumerate}\n\\item The sets $\\{\\mathfrak{h}\\in\\mathscr{H}(M)\\mid\\mathfrak{h}\\cap C\\neq\\emptyset,~\\mathfrak{h}^*\\cap C\\neq\\emptyset\\}$, ${\\{\\pi_C^{-1}(\\mathfrak{h})\\mid\\mathfrak{h}\\in\\mathscr{H}(C)\\}}$ and $\\mathscr{H}(C)$ are all naturally in bijection.\n\\item There exists a \\emph{pair of gates}, i.e.~a pair $(x,x')$ of points $x\\in C$ and $x'\\in C'$ such that $\\pi_C(x')=x$ and $\\pi_{C'}(x)=x'$. In particular, we have ${\\mathscr{H}(x|x')=\\mathscr{H}(C|C')}$.\n\\item If $C\\cap C'\\neq\\emptyset$, we have $\\pi_C(C')=C\\cap C'$ and $\\pi_C\\o\\pi_{C'}=\\pi_{C'}\\o\\pi_C$. In particular, if $C'\\subseteq C$, we have $\\pi_{C'}=\\pi_{C'}\\o\\pi_C$.\n\\end{enumerate}\n\\end{prop}\n\nA \\emph{topological median algebra} is a median algebra endowed with a Hausdorff topology so that $m$ is continuous. Every median space $X$ is a topological median algebra, since $m\\colon X^3\\rightarrow X$ is $1$-Lipschitz if we consider the $\\ell^1$ metric on $X^3$. Every gate-convex subset of a median space is closed and convex; the converse holds if $X$ is complete. Gate-projections are $1$-Lipschitz. If ${C,C'\\subseteq X}$ are gate-convex and $X$ is complete, points $x\\in C$ and $x'\\in C'$ form a pair of gates if and only if $d(x,x')=d(C,C')$, see Lemma~2.9 in \\cite{Fioravanti1}; this holds in particular when $C'$ is a singleton. \n\nWe will only consider complete, finite rank median space in the rest of the paper. The following is Proposition~B in \\cite{Fioravanti1}.\n\n\\begin{prop}\\label{all about halfspaces}\nEvery halfspace is either open or closed (possibly both). If $\\mathfrak{h}_1\\supsetneq ... \\supsetneq\\mathfrak{h}_k$ is a chain of halfspaces with $\\overline{\\mathfrak{h}_1^*}\\cap\\overline{\\mathfrak{h}_k}\\neq\\emptyset$, we have $k\\leq 2\\cdot\\text{rank}(X)$.\n\\end{prop}\n\n\\begin{lem}\\label{intersections of halfspaces}\nLet $\\mathcal{C}\\subseteq\\mathscr{H}$ be totally ordered by inclusion and suppose that the halfspaces in $\\mathcal{C}$ are at uniformly bounded distance from a point $x\\in X$. The intersection of all halfspaces in $\\mathcal{C}$ is nonempty. \n\\end{lem}\n\\begin{proof}\nIt suffices to consider the case when $\\mathcal{C}$ does not have a minimum; by Lemma~2.27 in \\cite{Fioravanti1}, we can find a cofinal subset $\\{\\mathfrak{h}_n\\}_{n\\geq 0}$ with $\\mathfrak{h}_{n+1}\\subsetneq\\mathfrak{h}_n$. Let $x_n$ be the gate-projection of $x$ to $\\overline{\\mathfrak{h}_n}$; by Proposition~\\ref{all about gates}, the sequence $(x_n)_{n\\geq 0}$ is Cauchy, hence it converges to a point $\\overline x\\in X$ that lies in $\\overline{\\mathfrak{h}_n}$ for all $n\\geq 0$. If $\\overline x$ did not lie in every $\\mathfrak{h}_n$, there would exist $N\\geq 0$ with $\\overline x\\in\\overline{\\mathfrak{h}_n}\\setminus\\mathfrak{h}_n$ for all $n\\geq N$. In particular, $\\overline{\\mathfrak{h}_n^*}\\cap\\overline{\\mathfrak{h}_m}\\neq\\emptyset$ for all $m,n\\geq N$ and this would violate Proposition~\\ref{all about halfspaces}.\n\\end{proof}\n\nEndowing $\\mathbb{R}^n$ with the $\\ell^1$ metric, we obtain a median space. Like $\\mathbb{R}^n$, a rich class of median spaces also has an analogue of the $\\ell^{\\infty}$ metric (see \\cite{Bow5}) and of the $\\ell^2$ metric (see \\cite{Bow4}). We record the following result for later use.\n\n\\begin{thm}[\\cite{Bow4}]\\label{CAT(0) metric}\nIf $X$ is connected, it admits is a bi-Lipschitz-equivalent ${\\rm CAT}(0)$ metric that is canonical in the sense that:\n\\begin{itemize}\n\\item every isometry of the median metric of $X$ is also an isometry for the ${\\rm CAT}(0)$ metric;\n\\item the ${\\rm CAT}(0)$ geodesic between $x$ and $y$ is contained in $I(x,y)$; in particular, subsets that are convex for the median metric are also convex for the ${\\rm CAT}(0)$ metric.\n\\end{itemize}\n\\end{thm}\n\nA \\emph{pointed measured pocset (PMP)} is a 4-tuple $\\left(\\mathscr{P},\\mathscr{D},\\eta,\\sigma\\right)$, where $\\mathscr{P}$ is a pocset, $\\sigma\\subseteq\\mathscr{P}$ is an ultrafilter, $\\mathscr{D}$ is a $\\sigma$-algebra of subsets of $\\mathscr{P}$ and $\\eta$ is a measure defined on $\\mathscr{D}$. Let $\\overline{\\mathcal{M}}\\left(\\mathscr{P},\\mathscr{D},\\eta\\right)$ be the set of all ultrafilters ${\\sigma'\\subseteq\\mathscr{P}}$ with $\\sigma'\\triangle\\sigma\\in\\mathscr{D}$, where we identify sets with $\\eta$-null symmetric difference. We endow this space with the extended metric $d(\\sigma_1,\\sigma_2):=\\eta(\\sigma_1\\triangle\\sigma_2)$. The set of points at finite distance from $\\sigma$ is a median space, which we denote $\\mathcal{M}\\left(\\mathscr{P},\\mathscr{D},\\eta,\\sigma\\right)$; see Section~2.2 in \\cite{Fioravanti1}.\n\nLet $X$ be a complete, finite rank median space. In \\cite{Fioravanti1} we constructed a semifinite measure $\\widehat{\\nu}$ defined on a $\\sigma$-algebra $\\widehat{\\mathscr{B}}\\subseteq 2^{\\mathscr{H}}$ such that $\\widehat{\\nu}(\\mathscr{H}(x|y))=d(x,y)$, for all $x,y\\in X$. There, we referred to elements of $\\widehat{\\mathscr{B}}$ as \\emph{morally measurable sets}, but, for the sake of simplicity, we will just call them \\emph{measurable sets} here. Note that this measure space is different from the ones considered in \\cite{CDH}. \n\nEvery inseparable subset of $\\mathscr{H}$ lies in $\\widehat{\\mathscr{B}}$; in particular, all ultrafilters on $\\mathscr{H}$ are measurable. If $C,C'\\subseteq X$ are convex (or empty), the set $\\mathscr{H}(C|C')$ is measurable and $\\widehat{\\nu}(\\mathscr{H}(C|C'))=d(C,C')$. A halfspace is an atom for $\\widehat{\\nu}$ if and only if it is clopen. The space $X$ is connected if and only if $\\widehat{\\nu}$ has no atoms, in which case $X$ is geodesic. We say that a halfspace $\\mathfrak{h}$ is \\emph{thick} if both $\\mathfrak{h}$ and $\\mathfrak{h}^*$ have nonempty interior; $\\widehat{\\nu}$-almost every halfspace is thick. We denote by $\\mathscr{H}^{\\times}$ the set of non-thick halfspaces. See \\cite{Fioravanti1} for proofs.\n\nPicking a basepoint $x\\in X$, we can identify $X\\simeq\\mathcal{M}(\\mathscr{H},\\widehat{\\mathscr{B}},\\widehat{\\nu},\\sigma_x)$ isometrically by mapping each $y\\in X$ to the ultrafilter $\\sigma_y\\subseteq\\mathscr{H}$, see Corollary~3.12 in \\cite{Fioravanti1}. In particular, $X$ sits inside the space $\\overline{\\mathcal{M}}(\\mathscr{H},\\widehat{\\mathscr{B}},\\widehat{\\nu})$, which we denote by $\\overline X$. If $I\\subseteq X$ is an interval, we have a projection $\\pi_I\\colon\\overline X\\rightarrow I$ that associates to each ultrafilter $\\sigma\\subseteq\\mathscr{H}$ the only point of $I$ that is represented by the ultrafilter $\\sigma\\cap\\mathscr{H}(I)$. We give $\\overline X$ the coarsest topology for which all the projections $\\pi_I$ are continuous. Defining\n\\[m(\\sigma_1,\\sigma_2,\\sigma_3):=(\\sigma_1\\cap\\sigma_2)\\cup(\\sigma_2\\cap\\sigma_3)\\cup(\\sigma_3\\cap\\sigma_1),\\]\nwe endow $\\overline X$ with a structure of topological median algebra. We have:\n\n\\begin{prop}[\\cite{Fioravanti1}]\nThe topological median algebra $\\overline X$ is compact. The inclusion $X\\hookrightarrow\\overline X$ is a continuous morphism of median algebras with dense, convex image.\n\\end{prop}\n\nWe call $\\overline X$ the \\emph{Roller compactification} of $X$ and $\\partial X:=\\overline X\\setminus X$ the \\emph{Roller boundary}. We remark that, in general, $X\\hookrightarrow\\overline X$ is not an embedding and $\\partial X$ is not closed in $\\overline X$. \n\nIf $C\\subseteq X$ is convex, the closure of $C$ in $X$ coincides with the intersection of $X$ and the closure of $C$ in $\\overline X$. If $C\\subseteq X$ is closed and convex, the closure of $C$ inside $\\overline X$ is canonically identified with the Roller compactification $\\overline C$. The median map of $\\overline X$ and the projections $\\pi_I\\colon\\overline X\\rightarrow I$ are $1$-Lipschitz with respect to the extended metric on $\\overline X$. \n\nLooking at pairs of points of $\\overline X$ at finite distance, we obtain a partition of $\\overline X$ into \\emph{components}; each component is a median space with the restriction of the extended metric of $\\overline X$. The subset $X\\subseteq\\overline X$ always forms an entire component of $\\overline X$.\n\n\\begin{prop}[\\cite{Fioravanti1}]\\label{components}\nEach component $Z\\subseteq\\partial X$ is a complete median space with $\\text{rank}(Z)\\leq\\text{rank}(X)-1$. Moreover, $Z$ is convex in $\\overline X$ and the inclusion $Z\\hookrightarrow\\overline X$ is continuous. The closure of $Z$ in $\\overline X$ is canonically identified with the Roller compactification $\\overline Z$ and there is a gate-projection $\\pi_Z\\colon\\overline X\\rightarrow\\overline Z$ that maps $X$ into $Z$.\n\\end{prop}\n\nEvery halfspace $\\mathfrak{h}\\in\\mathscr{H}$ induces a halfspace $\\widetilde{\\mathfrak{h}}$ of $\\overline X$ with $\\widetilde{\\mathfrak{h}}\\cap X=\\mathfrak{h}$; thus, we can identify $\\mathscr{H}$ with a subset of $\\mathscr{H}(\\overline X)$. \n\n\\begin{prop}[\\cite{Fioravanti1}]\\label{halfspaces of components}\nEvery thick halfspace of a component $Z\\subseteq\\partial X$ is of the form $\\widetilde{\\mathfrak{h}}\\cap Z$, for some $\\mathfrak{h}\\in\\mathscr{H}$.\n\\end{prop}\n\nAny two points of $\\overline X$ are separated by a halfspace of the form $\\widetilde{\\mathfrak{h}}$. To every $\\xi\\in\\overline X$, we can associate a \\emph{canonical ultrafilter} $\\sigma_{\\xi}\\subseteq\\mathscr{H}$ representing $\\xi$; it satisfies $\\mathfrak{h}\\in\\sigma_{\\xi}\\Leftrightarrow\\xi\\in\\widetilde{\\mathfrak{h}}$.\n\n\n\\subsection{Products.}\n\nGiven median spaces $X_1,X_2$, we can consider the product $X_1\\times X_2$, which is itself a median space with the $\\ell^1$ metric, i.e.\n\\[d_{X_1\\times X_2}\\left((x_1,x_2),(x'_1,x'_2)\\right):=d_{X_1}(x_1,x'_1)+d_{X_2}(x_2,x'_2).\\]\nThe space $X_1\\times X_2$ is complete if and only if $X_1$ and $X_2$ are. We say that subsets $A,B\\subseteq\\mathscr{H}$ are \\emph{transverse} if $\\mathfrak{h}$ and $\\mathfrak{k}$ are transverse whenever $\\mathfrak{h}\\in A$ and $\\mathfrak{k}\\in B$. We have the following analogue of Lemma~2.5 in \\cite{CS} (recall that we are only considering complete, finite rank median spaces).\n\n\\begin{cor}\\label{products}\nThe following are equivalent:\n\\begin{enumerate}\n\\item $X$ splits as a product $X_1\\times X_2$, where each $X_i$ has at least two points;\n\\item there is a measurable, $*$-invariant partition $\\mathscr{H}=\\mathscr{H}_1\\sqcup\\mathscr{H}_2$, where the $\\mathscr{H}_i$ are nonempty and transverse;\n\\item there is measurable, $*$-invariant partition $\\mathscr{H}=\\mathscr{H}_1\\sqcup\\mathscr{H}_2\\sqcup\\mathscr{K}$, where the $\\mathscr{H}_i$ are nonempty and transverse, while $\\mathscr{K}$ is null.\n\\end{enumerate}\n\\end{cor}\n\\begin{proof}\nIf $X=X_1\\times X_2$, part~1 of Proposition~\\ref{all about gates} provides subsets $\\mathscr{H}(X_1)$ and $\\mathscr{H}(X_2)$ of $\\mathscr{H}(X)$; they are nonempty, disjoint, $*$-invariant, transverse and measurable. Every $\\mathfrak{h}\\in\\mathscr{H}(X)$ must split a fibre $X_1\\times\\{*\\}$ or $\\{*\\}\\times X_2$ nontrivially and thus lies either in $\\mathscr{H}(X_1)$ or in $\\mathscr{H}(X_2)$.\n\nWe conclude by proving that 3 implies 1, since 2 trivially implies 3. Let $\\widehat{\\mathscr{B}}_i$ be the $\\sigma$-algebra of subsets of $\\mathscr{H}_i$ that lie in $\\widehat{\\mathscr{B}}$; fixing $x\\in X$, we simply write $\\mathcal{M}_i$ for $\\mathcal{M}(\\mathscr{H}_i,\\widehat{\\mathscr{B}}_i,\\widehat{\\nu},\\sigma_x\\cap\\mathscr{H}_i)$. Define a map $\\iota\\colon X\\rightarrow\\mathcal{M}_1\\times\\mathcal{M}_2$ by intersecting ultrafilters on $\\mathscr{H}$ with each $\\mathscr{H}_i$. Since $\\mathscr{K}$ is null, this is an isometric embedding. Given ultrafilters $\\sigma_i\\subseteq\\mathscr{H}_i$, the set $\\sigma_1\\sqcup\\sigma_2$ consists of pairwise-intersecting halfspaces and Zorn's Lemma provides an ultrafilter $\\sigma\\subseteq\\mathscr{H}$ containing $\\sigma_1\\sqcup \\sigma_2$. Thus, $\\iota$ is surjective and $X\\simeq\\mathcal{M}_1\\times\\mathcal{M}_2$.\n\nWe are left to show that each $\\mathcal{M}_i$ contains at least two points; we construct points $x_i,x_i'\\in X$ such that $\\widehat{\\nu}(\\mathscr{H}(x_i|x_i')\\cap\\mathscr{H}_i)>0$. Pick any $\\mathfrak{h}_i\\in\\mathscr{H}_i$; by Proposition~\\ref{all about halfspaces}, replacing $\\mathfrak{h}_i$ with its complement if necessary, we can assume that there exists $x_i\\not\\in\\overline{\\mathfrak{h}_i}$. Let $x_i'$ be the gate-projection of $x_i$ to $\\overline{\\mathfrak{h}_i}$. None of the halfspaces in $\\mathscr{H}(x_i|x_i')$ is transverse to $\\mathfrak{h}_i$, thus $\\mathscr{H}(x_i|x_i')\\setminus\\mathscr{K}$ is contained in $\\mathscr{H}_i$ and has positive measure.\n\\end{proof}\n\nIn particular, $\\text{rank}(X_1\\times X_2)=\\text{rank}(X_1)+\\text{rank}(X_2)$. We say that $X$ is \\emph{irreducible} if it cannot be split nontrivially as a product $X_1\\times X_2$. We remark that in parts~2 and~3 of Corollary~\\ref{products}, the sets $\\mathscr{H}_i$ are \\emph{not} required to have positive measure, but simply to be nonempty. The following is immediate from Corollary~\\ref{products}:\n\n\\begin{lem}\\label{Roller for products}\nIf $X=X_1\\times X_2$, we have $\\overline X=\\overline X_1\\times\\overline X_2$.\n\\end{lem}\n\nWe can also use Corollary~\\ref{products} to characterise isometries of products; the following is an analogue of Proposition~2.6 in \\cite{CS} (also compare with \\cite{Foertsch-Lytchak}, when $X$ is connected and locally compact).\n\n\\begin{prop}\\label{isometries of products}\nThere is a canonical decomposition $X= X_1\\times ... \\times X_k$, where each $X_i$ is irreducible. Every isometry of $X$ permutes the factors $X_i$; in particular, the product of the isometry groups of the factors has finite index in $\\text{Isom}~X$.\n\\end{prop}\n\\begin{proof}\nThe existence of such a splitting follows from the observation that, in any nontrivial product, factors have strictly lower rank. By Corollary~\\ref{products}, this corresponds to a transverse decomposition $\\mathscr{H}=\\mathscr{H}_1\\sqcup ...\\sqcup \\mathscr{H}_k$, where we can identify $\\mathscr{H}_i=\\mathscr{H}(X_i)$. Given $g\\in\\text{Isom}~X$, the decompositions\n\\[\\mathscr{H}_i=\\bigsqcup_{j=1}^k\\mathscr{H}_i\\cap g\\mathscr{H}_j\\]\nare transverse and each piece is measurable and $*$-invariant. Since $X_i$ is irreducible, we must have $\\mathscr{H}_i\\cap g\\mathscr{H}_j=\\emptyset$ for all but one $j$, again by Corollary~\\ref{products}, and the result follows.\n\\end{proof}\n\n\n\\subsection{Splitting the atom.}\\label{splitting the atom}\n\nIn this section we describe two constructions that allow us to embed median spaces into ``more connected'' ones. We will only consider complete, finite rank spaces.\n\nGiven a median space $X$, let $\\mathscr{A}\\subseteq\\mathscr{H}$ be the set of atoms of $\\widehat{\\nu}$. The idea is to split every atom into two ``hemiatoms'' of half the size. We thus obtain a new measured pocset $(\\mathscr{H}',\\mathscr{B}',\\nu')$, whose associated median space generalises barycentric subdivisions of cube complexes. We now describe this construction more in detail.\n\nAs a set, $\\mathscr{H}'$ consists of $\\mathscr{H}\\setminus\\mathscr{A}$, to which we add two copies $\\mathfrak{a}_+,\\mathfrak{a}_-$ of every $\\mathfrak{a}\\in\\mathscr{A}$; we have a projection $p\\colon\\mathscr{H}'\\rightarrow\\mathscr{H}$ with fibres of cardinality one or two. We give $\\mathscr{H}'$ a structure of poset by declaring that $\\mathfrak{j}\\subsetneq\\mathfrak{j}'$ if $p(\\mathfrak{j})\\subsetneq p(\\mathfrak{j}')$, or $\\mathfrak{j}=\\mathfrak{a}_-$ and $\\mathfrak{j}=\\mathfrak{a}_+$ for some $\\mathfrak{a}\\in\\mathscr{A}$. We promote this to a structure of pocset by setting $\\mathfrak{j}^*=\\mathfrak{j}'$ if $p(\\mathfrak{j})^*=p(\\mathfrak{j}')\\not\\in\\mathscr{A}$ and, in addition, $(\\mathfrak{a}_-)^*=(\\mathfrak{a}^*)_+$, $(\\mathfrak{a}_+)^*=(\\mathfrak{a}^*)_-$ if $\\mathfrak{a}\\in\\mathscr{A}$. Observe that each intersection between $\\mathscr{A}$ and a halfspace-interval is at most countable; thus $\\mathscr{A}$ and all its subsets are measurable. In particular $\\mathscr{B}':=\\{E\\subseteq\\mathscr{H}'\\mid p(E)\\setminus\\mathscr{A}\\in\\widehat{\\mathscr{B}}\\}$ is a $\\sigma$-algebra of subsets of $\\mathscr{H}'$, on which we can define the measure\n\\[\\nu'(E):=\\widehat{\\nu}\\left(p(E)\\setminus\\mathscr{A}\\right)+\\frac{1}{2}\\cdot\\sum_{\\substack{\\mathfrak{a}\\in\\mathscr{A} \\\\ \\mathfrak{a}_+\\in E}}\\widehat{\\nu}\\left(\\{\\mathfrak{a}\\}\\right)+\\frac{1}{2}\\cdot\\sum_{\\substack{\\mathfrak{a}\\in\\mathscr{A} \\\\ \\mathfrak{a}_-\\in E}}\\widehat{\\nu}\\left(\\{\\mathfrak{a}\\}\\right).\\]\nIf $F\\subseteq\\mathscr{H}$ is measurable, we have $\\nu'(p^{-1}(F))=\\widehat{\\nu}(F)$. Given $z\\in X$, we set $X':=\\mathcal{M}(\\mathscr{H}',\\mathscr{B}',\\nu',p^{-1}(\\sigma_z))$; note that this does not depend on the choice of $z$. Taking preimages under $p$ of ultrafilters on $\\mathscr{H}$, we obtain an isometric embedding $X\\hookrightarrow X'$.\n\n\\begin{lem}\\label{cubes in X'}\nFor each $x\\in X'\\setminus X$ there exist canonical subsets $C(x)\\subseteq X$, $\\widehat{C}(x)\\subseteq X'$ and isomorphisms of median algebras\n\\[\\iota_x\\colon\\{-1,1\\}^k\\rightarrow C(x),\\]\n\\[\\hat{\\iota}_x\\colon\\{-1,0,1\\}^k\\rightarrow\\widehat{C}(x).\\]\nHere $1\\leq k\\leq r:=\\text{rank}(X)$ and the map $\\hat{\\iota}_x$ extends $\\iota_x$ taking $(0,...,0)$ to $x$. Moreover, $C(x)$ is gate-convex in $X$ and $\\widehat{C}(x)$ is gate-convex in $X'$.\n\\end{lem}\n\\begin{proof}\nLet $\\sigma\\subseteq\\mathscr{H}'$ be an ultrafilter representing $x$; since $x\\not\\in X$ the set \n\\[ W(x):=\\left\\{\\{\\mathfrak{a},\\mathfrak{a}^*\\}\\in\\mathscr{W}(X)\\mid \\mathfrak{a}\\in\\mathscr{A} ~~\\text{and}~~ \\mathfrak{a}_+\\in\\sigma ~~\\text{and}~~ (\\mathfrak{a}^*)_+\\in\\sigma\\right\\}\\] \nis nonempty. Any two walls in $W(x)$ are transverse, so $k:=\\# W(x)\\leq r$; choose halfspaces $\\mathfrak{a}_1,...,\\mathfrak{a}_k\\in\\mathscr{H}$ representing all walls in $W(x)$. The set $p(\\sigma)\\setminus\\{\\mathfrak{a}_1^*,...,\\mathfrak{a}_k^*\\}$ is an ultrafilter on $\\mathscr{H}$ and it represents a point $q\\in X$. This will be the point $\\iota_x(1,...,1)$ in $C(x)$. To construct $q'\\in C(x)$, simply replace $\\mathfrak{a}_i\\in\\sigma_q\\subseteq\\mathscr{H}$ with $\\mathfrak{a}_i^*$ whenever the $i$-th coordinate of $q'$ is $-1$; the result is an ultrafilter on $\\mathscr{H}$ representing $q'\\in X$.\n\nTo construct a point $u\\in\\widehat{C}(x)\\subseteq X'$, consider the point $u'\\in C(x)$ obtained by replacing all the zero coordinates of $u$ with $1$'s. Whenever the $i$-th coordinate of $u$ is $0$, we replace $(\\mathfrak{a}_i)_-\\in p^{-1}(\\sigma_{u'})$ with $(\\mathfrak{a}_i^*)_+$, obtaining an ultrafilter on $\\mathscr{H}'$ that represents the point $u$. \n\nWe are left to check that $C(x)$ and $\\widehat{C}(x)$ are gate-convex. Let $H(x)\\subseteq\\mathscr{H}$ be the set of halfspaces corresponding to the walls of $W(x)$. We define a map $\\pi\\colon X'\\rightarrow\\widehat{C}(x)$ as follows: given an ultrafilter $\\sigma'\\subseteq\\mathscr{H}'$, the intersection $\\sigma'\\cap p^{-1}(H(x))$ determines a unique point of $\\widehat{C}(x)$ and we call this $\\pi(\\sigma')$. Note that the restriction of $\\pi$ to $X$ takes values in $C(x)$. It is straightforward to check that $\\pi$ and $\\pi|_X$ are gate-projections.\n\\end{proof}\n\n\\begin{lem}\\label{halfspaces of X'}\nEvery halfspace of $X'$ arises from an element of $\\mathscr{H}'$.\n\\end{lem}\n\\begin{proof}\nObserve that $\\text{Hull}_{X'}(X)=X'$ since, for every $x\\in X'$, the hull of $C(x)$ in $X'$ is $\\widehat{C}(x)$. Thus, every halfspace of $X'$ intersects $X$ in a halfspace of $X$. Given $\\mathfrak{h}\\in\\mathscr{H}$, we consider $\\mathscr{F}(\\mathfrak{h}):=\\left\\{\\mathfrak{k}\\in\\mathscr{H}(X')\\mid \\mathfrak{k}\\cap X=\\mathfrak{h}\\right\\}$; note that $\\mathscr{F}(\\mathfrak{h})\\neq\\emptyset$ by Lemma~6.5 in \\cite{Bow1}. If $\\mathfrak{h}\\in\\mathscr{A}$, we can construct halfspaces of $X'$ corresponding to $\\mathfrak{h}_+,\\mathfrak{h}_-\\in\\mathscr{H}'$. For instance, $\\mathfrak{h}_+$ corresponds to the set of ultrafilters on $\\mathscr{H}'$ that contain $\\mathfrak{h}_+$; this is well-defined as $\\mathfrak{h}_+$ has positive measure. Thus, we only need to show that $\\#\\mathscr{F}(\\mathfrak{h})=1$ if $\\mathfrak{h}\\in\\mathscr{H}\\setminus\\mathscr{A}$ and $\\mathscr{F}(\\mathfrak{h})=\\{\\mathfrak{h}_-,\\mathfrak{h}_+\\}$ if $\\mathfrak{h}\\in\\mathscr{A}$.\n\nIf, for some $\\mathfrak{k}\\in\\mathscr{H}(X')$ and $x\\in X'$, both $\\mathfrak{k}\\cap\\widehat{C}(x)$ and $\\mathfrak{k}^*\\cap\\widehat{C}(x)$ are nonempty, there exists $\\mathfrak{h}\\in\\mathscr{A}$ such that $\\mathfrak{k}\\in\\{\\mathfrak{h}_-,\\mathfrak{h}_+\\}$, by part~1 of Proposition~\\ref{all about gates}. Thus, we can suppose that, for every $x\\in X'$, we either have $\\widehat{C}(x)\\subseteq\\mathfrak{k}$ or $\\widehat{C}(x)\\subseteq\\mathfrak{k}^*$. Suppose, for the sake of contradiction, that the same is true of $\\mathfrak{k}'\\in\\mathscr{H}(X')$, with $\\mathfrak{k}'\\neq\\mathfrak{k}$ and $\\mathfrak{k}'\\cap X=\\mathfrak{k}\\cap X$. Let $z\\in\\mathfrak{k}\\triangle\\mathfrak{k}'$ be a point; observe that $z\\not\\in X$ and, by our assumptions, the hypercube $\\widehat{C}(z)$ is entirely contained in $\\mathfrak{k}\\triangle\\mathfrak{k}'$. This implies that $C(z)\\subseteq\\mathfrak{k}\\triangle\\mathfrak{k}'$, violating the fact that $\\mathfrak{k}'\\cap X=\\mathfrak{k}\\cap X$.\n\\end{proof}\n\nGiven a subgroup $\\Gamma\\leq\\text{Isom}~X$, we say that the action $\\Gamma\\curvearrowright X$ is \\emph{without wall inversions} if $g\\mathfrak{h}\\neq\\mathfrak{h}^*$ for every $g\\in\\Gamma$ and $\\mathfrak{h}\\in\\mathscr{H}$. We denote by $a(X)$ the supremum of the $\\widehat{\\nu}$-masses of the elements of $\\mathscr{A}$.\n\n\\begin{prop}[Properties of $X'$]\\label{properties of X'}\n\\begin{enumerate}\n\\item The median space $X'$ is complete and $\\text{rank}(X')=\\text{rank}(X)$.\n\\item There is an isometric embedding $X\\hookrightarrow X'$ and $\\text{Hull}_{X'}(X)=X'$.\n\\item Every isometry of $X$ extends canonically to an isometry of $X'$ yielding $\\text{Isom}~X\\hookrightarrow\\text{Isom}~X'$. Moreover, the induced action $\\text{Isom}~X\\curvearrowright X'$ is without wall inversions. \n\\item We have $a(X')\\leq\\frac{1}{2}\\cdot a(X)$.\n\\item The inclusion $X\\hookrightarrow X'$ canonically extends to a monomorphism of median algebras $\\overline X\\hookrightarrow\\overline{X'}$. For every $\\xi\\in\\overline{X'}\\setminus\\overline X$ there exists a canonical cube $\\{-1,0,1\\}^k\\hookrightarrow\\overline{X'}$ centred at $\\xi$, with $\\{-1,1\\}^k\\hookrightarrow\\overline{X}$ and $1\\leq k\\leq\\text{rank}(X)$.\n\\end{enumerate}\n\\end{prop}\n\\begin{proof}\nWe have already shown part~2 and part~4 is immediate. Part~5 can be proved like Lemma~\\ref{cubes in X'} since we now have Lemma~\\ref{halfspaces of X'}. If $g\\in\\text{Isom}~X$ and $\\mathfrak{h}\\in\\mathscr{H}$ satisfy $g\\mathfrak{h}=\\mathfrak{h}^*$, Proposition~\\ref{all about halfspaces} implies that the halfspace $\\mathfrak{h}$ is an atom; part~3 follows easily. By Lemma~\\ref{halfspaces of X'}, the only nontrivial statement in part~1 is the completeness of $X'$.\n\nLet $\\sigma_n\\subseteq\\mathscr{H}'$ be ultrafilters corresponding to a Cauchy sequence in $X'$. The sets $\\underline{\\sigma}:=\\liminf\\sigma_n$ and $\\overline{\\sigma}:=\\limsup\\sigma_n$ lie in $\\mathscr{B}'$. Any two halfspaces in $\\underline{\\sigma}$ intersect, thus, by Zorn's Lemma, it is contained in an ultrafilter $\\sigma\\subseteq\\mathscr{H}'$ with $\\sigma\\subseteq\\overline{\\sigma}$. If we show that $\\nu'(\\overline{\\sigma}\\setminus\\underline{\\sigma})=0$, it follows that $\\sigma\\in\\mathscr{B}'$ and the points of $X'$ represented by $\\sigma_n$ converge to the point of $X'$ represented by $\\sigma$. Note that it suffices to show that a subsequence of $(\\sigma_n)_{n\\geq 0}$ converges; in particular, we can assume that $\\nu'(\\sigma_n\\triangle\\sigma_{n+1})\\leq\\frac{1}{2^n}$ for all $n\\geq 0$. In this case, $\\overline{\\sigma}\\setminus\\underline{\\sigma}=\\limsup\\left(\\sigma_n\\triangle\\sigma_{n+1}\\right)$ has measure zero by the Borel-Cantelli Lemma. \n\\end{proof}\n\nWe will refer to $X'$ as the \\emph{barycentric subdivision} of $X$. Indeed, if $X$ is the $0$-skeleton of a ${\\rm CAT}(0)$ cube complex, $X'$ is the $0$-skeleton of the usual barycentric subdivision. \n\nA variation on this construction allows us to embed median spaces into connected ones. We define a sequence $(X_n)_{n\\geq 0}$ by setting $X_0:=X$ and $X_{n+1}:=X_n'$. These come equipped with compatible isometric embeddings $X_m\\hookrightarrow X_n$, for $mr\\cdot\\sum_{i=1}^kd(x,s_ix).\\] \nWe write $g=s_{i_1}...s_{i_n}$ and set $g_j:=s_{i_1}...s_{i_j}$ and $x_j:=g_jx$. We define inductively the points $y_j$, starting with $y_0=x_0=x$ and declaring $y_{j+1}$ to be the projection of $x_{j+1}$ to $I(y_j,gx)$. In particular $(y_j)_{0\\leq j\\leq n}$ is a geodesic from $x$ to $gx$ and $\\mathscr{H}(y_j|y_{j+1})\\subseteq\\mathscr{H}(x_j|x_{j+1})=g_j\\mathscr{H}(x|s_{i_{j+1}}x)$. The sets $U_j:=g_j^{-1}\\mathscr{H}(y_j|y_{j+1})$ all lie in $\\bigcup_i\\mathscr{H}(x|s_ix)$ and, since\n\\[\\sum_{j=0}^{n-1}\\widehat{\\nu}(U_j)=\\sum_{j=0}^{n-1}d(y_j,y_{j+1})=d(x,gx)>r\\cdot\\widehat{\\nu}\\left(\\bigcup_{i=1}^k\\mathscr{H}(x|s_ix)\\right),\\]\nthere exist $\\tau\\in\\{1,...,k\\}$ and a measurable subset $\\Omega\\subseteq\\mathscr{H}(x|s_{\\tau}x)$ such that $\\widehat{\\nu}(\\Omega)>0$ and $\\Omega\\subseteq U_j$ for $r+1$ indices $j_10$. If $x\\in g\\mathfrak{h}^*\\cap\\mathfrak{h}$, we have for $n\\geq 1$, \n\\[\\bigcup_{k=1}^{n-1}\\mathscr{H}(g^{kr}\\mathfrak{h}^*|g^{(k+1)r}\\mathfrak{h})\\subseteq\\mathscr{H}(x|g^{nr}x),\\]\nthus $d(x,g^{nr}x)\\geq (n-1)D$. Hence, the $\\langle g\\rangle$-orbit of $x$ is unbounded.\n\\end{proof}\n\n\\begin{proof}[Proof of Theorem~\\ref{Sageev's theorem}]\nThe action $\\Gamma\\curvearrowright X$ has bounded orbits or Proposition~\\ref{key point in Sageev} and Lemma~\\ref{nesting vs fixed points} would provide a non-elliptic isometry in $\\Gamma$. The conclusion follows from Corollary~\\ref{finite orbits}.\n\\end{proof}\n\nIn ${\\rm CAT}(0)$ cube complexes, Proposition~\\ref{key point in Sageev} above implies that the stabiliser $\\Gamma_{\\mathfrak{h}}$ of $\\mathfrak{h}$ is a codimension one subgroup of $\\Gamma$. This fails in general for actions on median spaces. \n\nFor instance, surface groups have free actions on real trees \\cite{Morgan-Shalen}; in these, all halfspace-stabilisers are trivial. One can still conclude that $\\Gamma_{\\mathfrak{h}}$ is codimension one as in \\cite{Sageev} if, in addition, for every $x,y\\in X$ we have $g\\mathfrak{h}\\in\\mathscr{H}(x|y)$ only for finitely many left cosets $g\\Gamma_{\\mathfrak{h}}$.\n\n\n\n\\section{Stabilisers of points in the Roller boundary.}\\label{stab xi}\n\nLet $X$ be a complete median space of finite rank $r$. Let $\\xi\\in\\partial X$ be a point in the Roller boundary; we denote by $\\text{Isom}_{\\xi}X$ the subgroup of $\\text{Isom}~X$ fixing the point $\\xi$. The main result of this section will be the following analogue of a result of P.-E.~Caprace (see the appendix to \\cite{CFI}).\n\n\\begin{thm}\\label{stabiliser of xi}\nThe group $\\text{Isom}_{\\xi}X$ contains a subgroup $K_{\\xi}$ of index at most $r!$ that fits in an exact sequence\n\\[1\\longrightarrow N_{\\xi}\\longrightarrow K_{\\xi} \\longrightarrow\\mathbb{R}^r.\\]\nEvery finitely generated subgroup of $N_{\\xi}$ has an orbit with at most $2^r$ elements.\n\\end{thm}\n\nIn order to prove this, we will have to extend to median spaces part of the machinery developed in \\cite{Hagen}.\n\n\\begin{defn}\\label{UBS}\nGiven $\\xi\\in\\partial X$, a \\emph{chain of halfspaces diverging to $\\xi$} is a sequence $(\\mathfrak{h}_n)_{n\\geq 0}$ of halfspaces of $X$ with $\\mathfrak{h}_n\\supsetneq\\mathfrak{h}_{n+1}$ and $\\xi\\in\\widetilde{\\mathfrak{h}}_n$ for all $n\\geq 0$ and such that $d(x,\\mathfrak{h}_n)\\rightarrow +\\infty$ for $x\\in X$. A \\emph{UBS} for $\\xi\\in\\partial X$ and $x\\in X$ is an inseparable subset $\\Omega\\subseteq\\sigma_{\\xi}\\setminus\\sigma_x$ that contains a chain of halfspaces diverging to $\\xi$.\n\\end{defn}\n\nThis is an analogue of Definition~3.4 in \\cite{Hagen}, except that we consider sets of halfspaces instead of sets of walls. For cube complexes, our definition is a bit more restrictive than Hagen's, since we assume by default that $\\Omega$ lie in some $\\sigma_{\\xi}\\setminus\\sigma_x$. This is enough for our purposes and avoids annoying technicalities.\n\nWe denote by $\\mathcal{U}(\\xi,x)$ the set of all UBS's for $\\xi$ and $x$ and we define a relation $\\preceq$:\n\\begin{align*}\n\\Omega_1\\preceq\\Omega_2 & \\xLeftrightarrow{\\text{def}^{\\underline{\\text{n}}}} \\sup_{\\mathfrak{h}\\in\\Omega_1\\setminus\\Omega_2} d(x,\\mathfrak{h})<+\\infty,\n\\end{align*}\nwhich we read as ``$\\Omega_1$ is \\emph{almost contained} in $\\Omega_2$''. If $\\Omega_1\\preceq\\Omega_2$ and $\\Omega_2\\preceq\\Omega_1$, we write $\\Omega_1\\sim\\Omega_2$ and say that $\\Omega_1$ and $\\Omega_2$ are \\emph{equivalent}. The relation $\\preceq$ descends to a partial order, also denoted $\\preceq$, on the set $\\overline{\\mathcal{U}}(\\xi,x)$ of $\\sim$-e\\-quiv\\-a\\-lence classes. We denote the equivalence class associated to the UBS $\\Omega$ by $[\\Omega]$. A UBS is said to be \\emph{minimal} if it projects to a minimal element of $\\overline{\\mathcal{U}}(\\xi,x)$. Two UBS's are \\emph{almost disjoint} if their intersection is not a UBS.\n\nWe will generally forget about the basepoint $x$ and simply write $\\left(\\overline{\\mathcal{U}}(\\xi),\\preceq\\right)$; indeed, if $x,y\\in X$, we have a canonical isomorphism $\\overline{\\mathcal{U}}(\\xi,x)\\simeq\\overline{\\mathcal{U}}(\\xi,y)$ given by intersecting UBS's with $\\sigma_{\\xi}\\setminus\\sigma_x$ or $\\sigma_{\\xi}\\setminus\\sigma_y$. \n\n\\begin{lem}\\label{almost disjoint} \nLet $\\Omega_1,\\Omega_2\\subseteq\\sigma_{\\xi}\\setminus\\sigma_x$ be UBS's. \n\\begin{enumerate}\n\\item If $\\Omega_1\\preceq\\Omega_2$, we have $\\widehat{\\nu}(\\Omega_1\\setminus\\Omega_2)<+\\infty$. In particular, if $\\Omega_1$ and $\\Omega_2$ are equivalent, we have $\\widehat{\\nu}\\left(\\Omega_1\\triangle\\Omega_2\\right)<+\\infty$.\n\\item The UBS's $\\Omega_1,\\Omega_2$ are almost disjoint if and only if $\\Omega_1\\cap\\Omega_2$ consists of halfspaces at uniformly bounded distance from $x$.\n\\end{enumerate}\n\\end{lem}\n\\begin{proof}\nBy Dilworth's Theorem \\cite{Dilworth}, we can decompose $\\Omega_1\\setminus\\Omega_2$ as a disjoint union $\\mathcal{C}_1\\sqcup ...\\sqcup\\mathcal{C}_k$, where each $\\mathcal{C}_i$ is totally ordered by inclusion and $k\\leq r$. If $\\Omega_1\\preceq\\Omega_2$, Lemma~\\ref{intersections of halfspaces} implies that the intersection and union of all halfspaces in $\\mathcal{C}_i$ are halfspaces $\\mathfrak{h}_i$ and $\\mathfrak{k}_i$, respectively. Thus, $\\Omega_1\\setminus\\Omega_2$ is contained in the union of the sets $\\mathscr{H}(\\mathfrak{k}_i^*|\\mathfrak{h}_i)$, which all have finite measure. \n\nSince $\\Omega_1\\cap\\Omega_2$ is inseparable, $\\Omega_1$ and $\\Omega_2$ are almost disjoint if and only if $\\Omega_1\\cap\\Omega_2$ does not contain a chain of halfspaces diverging to $\\xi$. By Lemma~\\ref{Ramsey}, this is equivalent to $\\Omega_1\\cap\\Omega_2$ being at uniformly bounded distance from $x$.\n\\end{proof}\n\nPart~1 of Lemma~\\ref{almost disjoint} is in general not an ``if and only if'' since UBS's can have finite measure. An example appears in the staircase in Figure~3 of \\cite{Fioravanti1}, where the UBS is given by the set of vertical halfspaces containing the bottom of the staircase.\n\n\\begin{figure}\n\\centering\n\\includegraphics[height=2.5in]{img3.png}\n\\caption{}\n\\label{CSC with a flap}\n\\end{figure}\nThe inseparable closure of a chain of halfspaces diverging to $\\xi$ is always a UBS and every minimal UBS is equivalent to a UBS of this form. However, not all UBS's of this form are minimal. For instance, consider the ${\\rm CAT}(0)$ square complex in Figure~\\ref{CSC with a flap}, which is a variation of the usual staircase with a one-dimensional flap. The inseparable closure of $\\{\\mathfrak{h}_n\\}_{n\\geq 0}$ is not a minimal UBS, since it also contains all $\\mathfrak{k}_n$, while the inseparable closures of $\\{\\mathfrak{h}_n\\}_{n\\geq 1}$ and $\\{\\mathfrak{k}_n\\}_{n\\geq 1}$ are minimal.\n\n\\begin{lem}\\label{symmetric almost-transversality}\nLet $(\\mathfrak{h}_m)_{m\\geq 0}$ and $(\\mathfrak{k}_n)_{n\\geq 0}$ be chains of halfspaces in $\\sigma_{\\xi}\\setminus\\sigma_x$ that diverge to $\\xi$. Suppose that no $\\mathfrak{h}_m$ lies in the inseparable closure of $\\{\\mathfrak{k}_n\\}_{n\\geq 0}$. Either almost every $\\mathfrak{k}_n$ is transverse to almost every $\\mathfrak{h}_m$, or almost every $\\mathfrak{h}_m$ is transverse to almost every $\\mathfrak{k}_n$.\n\\end{lem}\n\\begin{proof} \nWe first suppose that there exist $\\overline n,\\overline m\\geq 0$ such that $\\mathfrak{h}_{\\overline m}\\subseteq\\mathfrak{k}_{\\overline n}$; without loss of generality, $\\overline m=\\overline n=0$. An inclusion of the type $\\mathfrak{k}_n\\subseteq\\mathfrak{h}_m$ can never happen, or we would have $\\mathfrak{k}_n\\subseteq\\mathfrak{h}_m\\subseteq\\mathfrak{h}_0\\subseteq\\mathfrak{k}_0$ and $\\mathfrak{h}_0$ would lie in the inseparable closure of $\\{\\mathfrak{k}_n\\}_{n\\geq 0}$. Since the sequence $(\\mathfrak{k}_n)_{n\\geq 0}$ diverges, for every $m$ there exists $n(m)$ such that $\\mathfrak{k}_n$ does not contain $\\mathfrak{h}_m$ for $n\\geq n(m)$; thus, for $n\\geq n(m)$, the halfspaces $\\mathfrak{k}_n$ and $\\mathfrak{h}_m$ are transverse. \n\nNow suppose instead that an inclusion of the form $\\mathfrak{h}_m\\subseteq\\mathfrak{k}_n$ never happens. For every $n$, there exists $m(n)$ such that $\\mathfrak{k}_n$ is not contained in $\\mathfrak{h}_m$ for ${m\\geq m(n)}$; thus, for $m\\geq m(n)$, the halfspaces $\\mathfrak{k}_n$ and $\\mathfrak{h}_m$ are transverse.\n\\end{proof}\n\nFollowing \\cite{corrigendum}, we construct a directed graph $\\mathcal{G}(\\xi)$ as follows. Vertices of $\\mathcal{G}(\\xi)$ correspond to minimal elements of $\\left(\\overline{\\mathcal{U}}(\\xi),\\preceq\\right)$. Given diverging chains $(\\mathfrak{h}_m)_{m\\geq 0}$ and $(\\mathfrak{k}_n)_{n\\geq 0}$ in minimal UBS's $\\Omega$ and $\\Omega'$, respectively, we draw an oriented edge from $[\\Omega]$ to $[\\Omega']$ if almost every $\\mathfrak{h}_m$ is transverse to almost every $\\mathfrak{k}_n$, but the same does not happen if we exchange $(\\mathfrak{h}_m)_{m\\geq 0}$ and $(\\mathfrak{k}_n)_{n\\geq 0}$. This does not depend on which diverging chains we pick, as $\\Omega$, $\\Omega'$ are minimal.\n\nBy Lemma~\\ref{symmetric almost-transversality}, the vertices corresponding to $\\Omega$ and $\\Omega'$ are not joined by any edge if and only if almost every $\\mathfrak{h}_m$ is transverse to almost every $\\mathfrak{k}_n$ and almost every $\\mathfrak{k}_n$ is transverse to almost every $\\mathfrak{h}_m$. It is clear that there are no directed cycles of length $2$ in $\\mathcal{G}(\\xi)$.\n\n\\begin{lem}\\label{no directed cycles}\nIf there is a directed path from $[\\Omega]$ to $[\\Xi]$, there is an oriented edge from $[\\Omega]$ to $[\\Xi]$. In particular, $\\mathcal{G}(\\xi)$ contains no directed cycles.\n\\end{lem}\n\\begin{proof}\nIt suffices to prove that, if there is an edge from $[\\Omega]$ to $[\\Omega']$ and from $[\\Omega']$ to $[\\Omega'']$, there is also an edge from $[\\Omega]$ to $[\\Omega'']$. Pick diverging chains $(\\mathfrak{h}_n)_{n\\geq 0}$, $(\\mathfrak{h}'_n)_{n\\geq 0}$, $(\\mathfrak{h}''_n)_{n\\geq 0}$ in $\\Omega$, $\\Omega'$, $\\Omega''$, respectively. By hypothesis, there are infinitely many $\\mathfrak{h}_k''$ that are not transverse to almost every $\\mathfrak{h}'_j$; thus, for every $k$ there exists $j$ such that $\\mathfrak{h}''_k\\supseteq\\mathfrak{h}'_j$. A similar argument works for $\\Omega$ and $\\Omega'$; hence, for every $k$ there exist $i,j$ such that $\\mathfrak{h}''_k\\supseteq\\mathfrak{h}'_j\\supseteq\\mathfrak{h}_i$. If no oriented edge from $[\\Omega]$ to $[\\Omega'']$ existed, almost every $\\mathfrak{h}''_k$ would be transverse to almost every $\\mathfrak{h}_i$ and this would contradict the previous statement.\n\\end{proof}\n\n\\begin{rmk}\\label{graph for any chains}\nA graph like $\\mathcal{G}(\\xi)$ above can be constructed whenever we have a family of diverging chains $(\\mathfrak{h}_n^i)_{n\\geq 0}$, $i\\in I$, with the property that, if $i\\neq j$, either no $\\mathfrak{h}_m^i$ lies in the inseparable closure of $\\{\\mathfrak{h}_n^j\\}_{n\\geq 0}$ or vice versa. Lemma~\\ref{no directed cycles} and part~1 of Proposition~\\ref{main prop on UBS's} below still hold in this context.\n\\end{rmk}\n\nWe say that a collection of vertices $\\mathcal{V}\\subseteq\\mathcal{G}(\\xi)^{(0)}$ is \\emph{inseparable} if, for every $v,w\\in\\mathcal{V}$, all the vertices on the directed paths from $v$ to $w$ also lie in $\\mathcal{V}$. The following extends Lemma~3.7 and Theorem~3.10 in \\cite{Hagen}.\n\n\\begin{prop}\\label{main prop on UBS's}\n\\begin{enumerate}\n\\item The graph $\\mathcal{G}(\\xi)$ has at most $r$ vertices.\n\\item For every UBS $\\Omega$ there exists a minimal UBS $\\Omega'\\preceq\\Omega$. If $\\Omega$ is the inseparable closure of a diverging chain $(\\mathfrak{h}_n)_{n\\geq 0}$, we can take $\\Omega'$ to be the inseparable closure of $(\\mathfrak{h}_n)_{n\\geq N}$, for some $N\\geq 0$.\n\\item Given a UBS $\\Omega$ and a set $\\{\\Omega_1,...,\\Omega_k\\}$ of representatives of all equivalence classes of minimal UBS's almost contained in $\\Omega$, we have\n\\[\\sup_{\\mathfrak{h}\\in\\Omega\\triangle\\left(\\Omega_1\\cup ... \\cup\\Omega_k\\right)} d(x,\\mathfrak{h})<+\\infty.\\]\n\\item There is an isomorphism of posets between $\\left(\\overline{\\mathcal{U}}(\\xi),\\preceq\\right)$ and the collection of inseparable subsets of $\\mathcal{G}(\\xi)^{(0)}$, ordered by inclusion. It is given by associating to $[\\Omega]$ the set $\\{[\\Omega_1],...,[\\Omega_k]\\}$ of minimal equivalence classes of UBS's almost contained in $\\Omega$.\n\\end{enumerate}\n\\end{prop}\n\\begin{proof}\nTo prove part~1, we show that every finite subset $\\mathcal{V}\\subseteq\\mathcal{G}(\\xi)^{(0)}$ satisfies ${\\#\\mathcal{V}\\leq r}$; more precisely, we prove by induction on $k$ that, if $\\Omega_1,...,\\Omega_k$ are UBS's representing the elements of $\\mathcal{V}$, we can find pairwise-transverse halfspaces $\\mathfrak{h}_i\\in\\Omega_i$. The case $k=1$ is trivial; suppose $k\\geq 2$. By Lemma~\\ref{no directed cycles} we can assume, up to reordering the $\\Omega_i$, that there is no edge from $[\\Omega_i]$, $i\\leq k-1$, to $[\\Omega_k]$. There exist $\\mathfrak{h}\\in\\Omega_k$ and diverging chains $\\{\\mathfrak{k}_n^i\\}_{n\\geq 0}\\subseteq\\Omega_i$, $i\\leq k-1$, that are transverse to $\\mathfrak{h}$; in particular, $\\mathfrak{h}$ is transverse to every element in the inseparable closure of $\\{\\mathfrak{k}_n^i\\}_{n\\geq 0}$, for $i\\leq k-1$. By the inductive hypothesis, we can find $\\mathfrak{h}_i$ in the inseparable closure of $\\{\\mathfrak{k}_n^i\\}_{n\\geq 0}$ so that $\\mathfrak{h}_1,...,\\mathfrak{h}_{k-1}$ are pairwise transverse. Hence $\\mathfrak{h},\\mathfrak{h}_1,...,\\mathfrak{h}_{k-1}$ are pairwise transverse.\n\nIf $\\Omega_1\\prec...\\prec\\Omega_k$ is a chain of non-equivalent UBS's, we have $k\\leq r$. Indeed, we can consider diverging chains in $\\Omega_1$ and in $\\Omega_i\\setminus\\Omega_{i-1}$ for $2\\leq i\\leq k$, which exist by Lemma~\\ref{Ramsey}, and appeal to Remark~\\ref{graph for any chains}. This implies the existence of minimal UBS's almost contained in any UBS. It also shows that, for every diverging chain $(\\mathfrak{h}_n)_{n\\geq 0}$, there exists $N\\geq 0$ such that the inseparable closures $\\Omega_M$ of $(\\mathfrak{h}_n)_{n\\geq M}$ are all equivalent for $M\\geq N$. In particular, every diverging chain in $\\Omega_N$ has a cofinite subchain that is contained in $\\Omega_M$, if ${M\\geq N}$. By Lemma~\\ref{symmetric almost-transversality}, the UBS $\\Omega_N$ is equivalent to the inseparable closure of any diverging chain it contains, i.e.~$\\Omega_N$ is minimal. This proves part~2.\n\nRegarding part~3, it is clear that the supremum over $\\left(\\Omega_1\\cup ... \\cup\\Omega_k\\right)\\setminus\\Omega$ is finite. If the supremum over $\\Omega\\setminus\\left(\\Omega_1\\cup ... \\cup\\Omega_k\\right)$ were infinite, Lemma~\\ref{Ramsey} and part~2 would provide a diverging chain in $\\Omega\\setminus\\left(\\Omega_1\\cup ... \\cup\\Omega_k\\right)$ whose inseparable closure $\\Omega'$ is a minimal UBS. Thus $\\Omega'\\preceq\\Omega$, but $\\Omega'\\not\\sim\\Omega_i$ for all $i$, a contradiction.\n\nFinally, we prove part~4. The map $[\\Omega]\\mapsto\\{[\\Omega_1],...,[\\Omega_k]\\}$ is an injective morphism of posets by part~3. The collection $\\{[\\Omega_1],...,[\\Omega_k]\\}$ is inseparable since the inseparable closure of $(\\Omega_i\\cap\\Omega)\\cup(\\Omega_j\\cap\\Omega)$ contains all minimal UBS's corresponding to vertices on directed paths from $[\\Omega_i]$ to $[\\Omega_j]$ and vice versa; this follows for instance from the proof of Lemma~\\ref{no directed cycles}.\n\nGiven an inseparable collection $\\{[\\Omega_1],...,[\\Omega_k]\\}$, we construct a UBS $\\Omega$ such that these are precisely the equivalence classes of minimal UBS's almost contained in $\\Omega$. Let $(\\mathfrak{h}_n^i)_{n\\geq 0}$ be a diverging chain in $\\Omega_i$, for every $i$, and denote by $\\Omega^N$ the inseparable closure of ${\\{\\mathfrak{h}_n^1\\}_{n\\geq N}\\cup...\\cup\\{\\mathfrak{h}_n^k\\}_{n\\geq N}}$. If $N$ is large enough, every minimal UBS almost contained in $\\Omega^N$ is equivalent to one of the $\\Omega_i$. Otherwise, by part~1, we would be able to find a diverging chain $\\{\\mathfrak{h}_n\\}_{n\\geq 0}$ such that its inseparable closure $\\Xi$ is not equivalent to any of the $\\Omega_i$ and $\\mathfrak{h}_{a_n}^j\\subseteq\\mathfrak{h}_n\\subseteq\\mathfrak{h}_{b_n}^k$, for some $j,k$, with $b_n\\rightarrow+\\infty$. \nThis implies that $\\Xi$ lies on a directed path from $[\\Omega_j]$ to $[\\Omega_k]$ and contradicts inseparability of the collection $\\{[\\Omega_1],...,[\\Omega_k]\\}$.\n\\end{proof}\n\nLet $\\Omega\\subseteq\\sigma_{\\xi}\\setminus\\sigma_x$ be a UBS and let $K_{\\Omega}\\leq\\text{Isom}_{\\xi}X$ be the subgroup of isometries that preserve the equivalence class $[\\Omega]$. We can construct a homomorphism analogous to the one in Proposition~4.H.1 in \\cite{Cor}:\n\\begin{align*}\n\\chi_{\\Omega}\\colon K_{\\Omega} \\longrightarrow & \\mathbb{R} \\nonumber \\\\\ng\\longmapsto & \\widehat{\\nu}\\left(g^{-1}\\Omega\\setminus\\Omega\\right)- \\widehat{\\nu}\\left(\\Omega\\setminus g^{-1}\\Omega \\right) .\n\\end{align*}\nWe will refer to $\\chi_{\\Omega}$ as the \\emph{transfer character} associated to $\\Omega$. We remark that the definition makes sense due to part~1 of Lemma~\\ref{almost disjoint}. The arguments in \\cite{Cor}, show that $\\chi_{\\Omega}$ does not change if we replace $\\Omega$ with a measurable set $\\Omega'\\subseteq\\mathscr{H}$ such that $\\widehat{\\nu}\\left(\\Omega\\triangle\\Omega'\\right)<+\\infty$. Thus transfer characters only depend on the equivalence class of the UBS $\\Omega$. Moreover, if $\\{\\Omega_1,...,\\Omega_k\\}$ is a set of representatives of all equivalence classes of minimal UBS's almost contained in $\\Omega$, we have $\\chi_{\\Omega}=\\chi_{\\Omega_1}+...+\\chi_{\\Omega_k}$ by part~3 of Proposition~\\ref{main prop on UBS's}.\n\nNow, let $\\Omega_1,...,\\Omega_k$ be UBS's representing all minimal elements of $\\overline{\\mathcal{U}}(\\xi)$. The group $\\text{Isom}_{\\xi}X$ permutes the equivalence classes of the $\\Omega_i$ and a subgroup $K_{\\xi}\\leq\\text{Isom}_{\\xi}X$ of index at most $k!\\leq r!$ preserves them all. Note that, by part~4 of Proposition~\\ref{main prop on UBS's}, this is precisely the kernel of the action of $\\text{Isom}_{\\xi}X$ on $\\overline{\\mathcal{U}}(\\xi)$. We define a homomorphism $\\chi_{\\xi}:=(\\chi_{\\Omega_1},...,\\chi_{\\Omega_k})\\colon K_{\\xi}\\rightarrow \\mathbb{R}^k$.\n\n\\begin{prop}\\label{kernel of chi}\nEvery finitely generated subgroup $\\Gamma\\leq\\ker\\chi_{\\xi}$ has an orbit in $X$ with at most $2^r$ elements.\n\\end{prop}\n\\begin{proof}\nIf $\\Gamma$ did not have an orbit with at most $2^r$ elements, all orbits would be unbounded by Corollary~\\ref{finite orbits} and Proposition~\\ref{key point in Sageev} would provide ${\\mathfrak{h}\\in\\mathscr{H}}$ and $g\\in\\Gamma$ with $g\\mathfrak{h}\\subsetneq\\mathfrak{h}$; hence ${d(g^r\\mathfrak{h},\\mathfrak{h}^*)>0}$ by Proposition~\\ref{all about halfspaces}. If $\\xi\\in\\widetilde{\\mathfrak{h}}^*$, we replace $\\mathfrak{h}$ with $\\mathfrak{h}^*$ and $g$ with $g^{-1}$. Now $(g^{nr}\\mathfrak{h})_{n\\geq 0}$ is a sequence of halfspaces diverging to $\\xi$ and, by part~2 of Proposition~\\ref{main prop on UBS's}, the inseparable closure $\\Omega^N$ of $\\{g^{nr}\\mathfrak{h}\\}_{n\\geq N}$ is a minimal UBS if $N$ is large enough. Thus, $\\Omega^N\\sim\\Omega_i$ for some $i$ and we have ${0=\\chi_{\\Omega_i}(g)=\\chi_{\\Omega^N}(g)}$. We obtain a contradiction by observing that\n\\[r\\cdot\\chi_{\\Omega^N}(g)=\\chi_{\\Omega^N}(g^r)\\geq\\widehat{\\nu}\\left(\\mathscr{H}(\\mathfrak{h}^*|g^r\\mathfrak{h})\\setminus\\{g^r\\mathfrak{h}\\}\\right)> 0.\\]\n\\end{proof}\n\nTheorem~\\ref{stabiliser of xi} immediately follows from Proposition~\\ref{kernel of chi}. \n\n\n\n\\section{Caprace-Sageev machinery.}\\label{CS-like machinery}\n\nLet $X$ be a complete median space of finite rank $r$. The goal of this section is extending to median spaces Theorem~4.1 and Proposition~5.1 from \\cite{CS}. \n\nOur techniques provide a different approach also in the case of ${\\rm CAT}(0)$ cube complexes, as we use Roller boundaries instead of visual boundaries. This strategy of proof was suggested to us by T. Fern\\'os.\n\nLet $\\Gamma$ be a group of isometries of $X$. We say that $g\\in \\Gamma$ \\emph{flips} $\\mathfrak{h}\\in\\mathscr{H}$ if ${d\\left(g\\mathfrak{h}^*,\\mathfrak{h}^*\\right)>0}$ and $g\\mathfrak{h}^*\\neq\\mathfrak{h}$. The halfspace $\\mathfrak{h}$ is \\emph{$\\Gamma$-flippable} if some $g\\in \\Gamma$ flips it.\n\n\\begin{thm}\\label{flipping}\nSuppose $\\Gamma$ acts without wall inversions. For every thick halfspace, exactly one of the following happens:\n\\begin{enumerate}\n\\item $\\mathfrak{h}$ is $\\Gamma$-flippable;\n\\item the closure of $\\widetilde{\\mathfrak{h}}^*$ in $\\overline X$ contains a proper, closed, convex, $\\Gamma$-invariant subset $C\\subseteq\\overline X$.\n\\end{enumerate}\n\\end{thm}\n\\begin{proof}\nIf $\\mathfrak{h}$ is $\\Gamma$-flippable, $\\overline{\\mathfrak{h}^*}$ and $g\\overline{\\mathfrak{h}^*}$ are disjoint subsets of $X$; let $(x,x')$ be a pair of gates and $I:=I(x,x')$. Observe that $\\pi_I$ maps the closure of $\\widetilde{\\mathfrak{h}}^*$ to $x$ and the closure of $g\\widetilde{\\mathfrak{h}}^*$ to $x'$; hence, any wall of $X$ separating $x$ and $x'$ induces a wall of $\\overline X$ separating the closures of $\\widetilde{\\mathfrak{h}}^*$ and $g\\widetilde{\\mathfrak{h}}^*$. Thus, options 1 and 2 are mutually exclusive. If 1 does not hold, we have $g\\overline{\\mathfrak{h}^*}\\cap\\overline{\\mathfrak{h}^*}\\neq\\emptyset$ for every $g\\in\\Gamma$, since the action has no wall inversions. Helly's Theorem implies that the closures of the sets $g\\widetilde{\\mathfrak{h}}^*$, $g\\in\\Gamma$, have the finite intersection property and, since $\\overline X$ is compact, their intersection $C$ is nonempty. It is closed, convex and $\\Gamma$-invariant; since $\\mathfrak{h}$ is thick, we have $C\\neq\\overline X$. \n\\end{proof}\n\nThe thickness assumption in Theorem~\\ref{flipping} is necessary. Consider the real tree obtained from the ray $[0,+\\infty)$ by attaching a real line $\\ell_n$ to the point $\\frac{1}{n}$ for every $n\\geq 1$. Complete this to a real tree $T$ so that there exist isometries $g_n$ with axes $\\ell_n$; let $\\Gamma$ be the group generated by these. The minimal subtree for $\\Gamma$ contains all the lines $\\ell_n$; let $X$ be its closure in $T$. The action $\\Gamma\\curvearrowright X$ does not preserve any proper, closed, convex subset of $\\overline X$, but the singleton $\\{0\\}$ inside the original ray is a halfspace that is not flipped by $\\Gamma$.\n\nWe remark that any action on a connected median space is automatically without wall inversions by Proposition~\\ref{all about halfspaces}. When $X$ is connected, we denote by $\\partial_{\\infty}X$ the visual boundary of the ${\\rm CAT}(0)$ space arising from Theorem~\\ref{CAT(0) metric}. If no proper, closed, convex subset of $X$ is $\\Gamma$-invariant, the following describes the only obstruction to flippability of halfspaces.\n\n\\begin{prop}\\label{visual boundary vs Roller boundary}\nIf $X$ is connected, there exists a closed, convex, $\\Gamma$-invariant subset $C\\subseteq\\partial X$ if and only if $\\Gamma$ fixes a point of $\\partial_{\\infty}X$.\n\\end{prop}\n\\begin{proof}\nSuppose $C\\subseteq\\partial X$ is closed, convex and $\\Gamma$-invariant; Lemma~2.6 in \\cite{Fioravanti1} implies that $C$ is gate-convex, hence the set $\\sigma_C:=\\{\\mathfrak{h}\\in\\mathscr{H}\\mid C\\subseteq\\widetilde{\\mathfrak{h}}\\}$ is nonempty as it contains all halfspaces separating $x\\in X$ and $\\pi_C(x)$. By Theorem~\\ref{flipping}, any $\\mathfrak{h}\\in\\sigma_C^*$ is not $\\Gamma$-flippable; thus $\\{g\\overline{\\mathfrak{h}}\\mid\\mathfrak{h}\\in\\sigma_C,~g\\in\\Gamma\\}$ is a collection of subsets of $X$ with the finite intersection property. These subsets are convex also with respect to the ${\\rm CAT}(0)$ metric and their intersection is empty. The topological dimension of every compact subset of $X$ is bounded above by the rank of $X$, see Lemma~2.10 in \\cite{Fioravanti1} and Theorem~2.2, Lemma~7.6 in \\cite{Bow1}; thus, the geometric and telescopic dimensions (see \\cite{CL}) of the ${\\rm CAT}(0)$ metric are at most $r$. The existence of a fixed point in $\\partial_{\\infty}X$ now follows from Proposition~3.6 in \\cite{CS}.\n\nConversely, suppose $\\zeta\\in\\partial_{\\infty}X$ is fixed by $\\Gamma$. The intersection of a halfspace of $X$ and a ray for the ${\\rm CAT}(0)$ metric is either empty or a subray. Hence, given $x\\in X$, the subset $\\sigma(x,\\zeta)\\subseteq\\mathscr{H}$ of halfspaces intersecting the ray $x\\zeta$ in a subray is an ultrafilter; it represents a point $\\xi(x,\\zeta)\\in\\overline X$. If $y\\in X$ is another point and $x_n,y_n$ are points diverging along the rays $x\\zeta$ and $y\\zeta$, we have $\\sigma(x,\\zeta)\\triangle\\sigma(y,\\zeta)\\subseteq\\liminf\\left(\\mathscr{H}(x_n|y_n)\\cup\\mathscr{H}(y_n|x_n)\\right)$. For every $n$, the points $x_n$ and $y_n$ are at most as far apart as $x$ and $y$ in the ${\\rm CAT}(0)$ metric; since the latter is bi-Lipschitz equivalent to the median metric on $X$, we conclude that $\\widehat{\\nu}\\left(\\sigma(x,\\zeta)\\triangle\\sigma(y,\\zeta)\\right)<+\\infty$. Thus, $\\xi(x,\\zeta)$ and $\\xi(y,\\zeta)$ lie in the same component $Z\\subseteq\\overline X$, which is $\\Gamma$-invariant. Moreover, $\\xi(x,\\zeta)\\not\\in X$ as $\\mathscr{H}(x|z)\\subseteq\\sigma(x,\\zeta)$ for every $z$ on the ray $x\\zeta$; hence $Z\\subseteq\\partial X$. Finally, it is easy to show that $\\overline Z\\subseteq\\partial X$.\n\\end{proof}\n\nWe are interested in studying actions where every thick halfspace is flippable, see Corollary~\\ref{double skewering} below. To this end, we introduce the following notions of non-elementarity.\n\n\\begin{defn}\\label{elementarity notion}\nWe say that the action $\\Gamma\\curvearrowright X$ is:\n\\begin{itemize} \n\\item \\emph{Roller nonelementary} if $\\Gamma$ has no finite orbit in $\\overline X$; \n\\item \\emph{Roller minimal} if $X$ is not a single point and $\\Gamma$ does not preserve any proper, closed, convex subset of the Roller compactification $\\overline X$.\n\\item \\emph{essential} if $\\Gamma$ does not preserve any proper, closed, convex subset of the median space $X$.\n\\end{itemize}\n\\end{defn}\n\nThe action of $\\Gamma$ is Roller elementary if and only if a finite-index subgroup of $\\Gamma$ fixes a point of $\\overline X$; thus, Roller nonelementarity passes to finite index subgroups. This fails for Roller minimality. For instance, consider the action of $\\Gamma=\\mathbb{Z}^2\\rtimes\\mathbb{Z}\/4\\mathbb{Z}$ on the the standard cubulation of $\\mathbb{R}^2$; the action of $H:=\\mathbb{Z}^2$ is by translations, whereas $\\mathbb{Z}\/4\\mathbb{Z}$ rotates around the origin. The action of $\\Gamma$ is Roller minimal, but $H$ has four fixed points in the Roller compactification.\n\nThe same example shows that Roller minimal actions might not be Roller nonelementary. Roller nonelementary actions need not be Roller minimal either: Let $T$ be the Cayley graph of a nonabelian free group $F$ and consider the product action of $F\\times\\mathbb{Z}$ on $T\\times\\mathbb{R}$. It is Roller nonelementary but leaves invariant two components of the Roller boundary, both isomorphic to $T$.\n\nBy Proposition~\\ref{visual boundary vs Roller boundary}, an essential action $\\Gamma\\curvearrowright X$ is Roller minimal if and only if no point of the visual boundary $\\partial_{\\infty}X$ is fixed by $\\Gamma$. In particular, an essential action with no finite orbits in $\\partial_{\\infty}X$ is always Roller minimal and Roller nonelementary. \n\nThe following is immediate from Theorem~\\ref{flipping} and the proof of the Double Skewering Lemma in the introduction of \\cite{CS}.\n\n\\begin{cor}\\label{double skewering}\nIf $\\Gamma\\curvearrowright X$ is Roller minimal and without wall inversions, every thick halfspace is $\\Gamma$-flippable. Moreover, if $\\mathfrak{h}\\subseteq\\mathfrak{k}$ are thick halfspaces, there exists $g\\in\\Gamma$ such that $g\\mathfrak{k}\\subsetneq\\mathfrak{h}\\subseteq\\mathfrak{k}$ and $d(g\\mathfrak{k},\\mathfrak{h}^*)>0$.\n\\end{cor}\n\nOne can usually reduce to studying a Roller minimal action by appealing to the following result. \n\n\\begin{prop}\\label{Roller elementary vs strongly so}\nEither $\\Gamma\\curvearrowright\\overline X$ fixes a point or there exist a $\\Gamma$-invariant component $Z\\subseteq\\overline X$ and a $\\Gamma$-invariant, closed, convex subset ${C\\subseteq Z}$ such that $\\Gamma\\curvearrowright C$ is Roller minimal.\n\\end{prop}\n\\begin{proof}\nLet $K\\subseteq\\overline X$ be a minimal, nonempty, closed, $\\Gamma$-invariant, convex subset; it exists by Zorn's Lemma. Corollary~4.31 in \\cite{Fioravanti1} provides a component $Z\\subseteq\\overline X$ of maximal rank among those that intersect $K$. Since $Z$ must be $\\Gamma$-invariant, we have $\\overline Z\\cap K= K$ by the minimality of $K$, i.e.~$K\\subseteq\\overline Z$. The set $C:=K\\cap Z$ is nonempty, convex, $\\Gamma$-invariant and closed in $Z$, since the inclusion $Z\\hookrightarrow\\overline X$ is continuous. By minimality of $K$, we have $K=\\overline C$ and the latter can be identified with the Roller compactification of $C$ (see Lemma~4.8 in \\cite{Fioravanti1}). We conclude that either $\\Gamma\\curvearrowright C$ is Roller minimal or $C$ is a single point.\n\\end{proof}\n\n\\begin{cor}\\label{Roller elementary vs strongly so 2}\nIf $\\Gamma\\curvearrowright X$ is Roller nonelementary, there exist a $\\Gamma$-in\\-variant component $Z\\subseteq\\overline X$ and a $\\Gamma$-invariant, closed, convex subset $C\\subseteq Z$ such that $\\Gamma\\curvearrowright C$ is Roller minimal and Roller nonelementary.\n\\end{cor}\n\nWe remark that the following is immediate from part~5 of Proposition~\\ref{properties of X'}:\n\n\\begin{lem}\\label{RNE for X'}\nThe action $\\Gamma\\curvearrowright X$ is Roller elementary if and only if the action $\\Gamma\\curvearrowright X'$ is.\n\\end{lem}\n\nRelying on Theorem~E, we can already provide a proof of Theorem~A.\n\n\\begin{proof}[Proof of Theorem~A]\nSince $\\Gamma$ contains no nonabelian free subgroups, the action $\\Gamma\\curvearrowright X$ is Roller elementary by Theorem~E. Theorem~F yields a finite-index subgroup $\\Gamma_0\\leq\\Gamma$ and $N\\lhd\\Gamma_0$ such that $\\Gamma_0\/N$ is abelian and every finitely generated subgroup of $N$ has an orbit with at most $2^r$ elements. \n\nIf all point stabilisers are amenable, $N$ is amenable, as it is the direct limit of its finitely generated subgroups; hence, $\\Gamma$ is amenable. If $\\Gamma\\curvearrowright X$ is\nproper, every finitely generated subgroup of $N$ is finite. If $\\Gamma\\curvearrowright X$ is free, $N$ is finite; if $X$ is connected, $N$ must be trivial by Theorem~\\ref{CAT(0) metric} and Cartan's fixed point theorem. Finally, finitely generated finite-by-abelian groups are virtually abelian, for instance by Lemma~II.7.9 in \\cite{BH}.\n\\end{proof}\n\nWe now proceed to obtain an analogue of Proposition~5.1 from \\cite{CS}, namely Theorem~\\ref{strong separation} below. We say that $\\mathfrak{h},\\mathfrak{k}\\in\\mathscr{H}$ are \\emph{strongly separated} if $\\overline{\\mathfrak{h}}\\cap\\overline{\\mathfrak{k}}=\\emptyset$ and no $\\mathfrak{j}\\in\\mathscr{H}$ is transverse to both $\\mathfrak{h}$ and $\\mathfrak{k}$.\n\n\\begin{lem}\\label{slight reformulation of SS}\nHalfspaces with disjoint closures are strongly separated if and only if no thick halfspace is transverse to both.\n\\end{lem}\n\\begin{proof}\nSuppose that $\\overline{\\mathfrak{h}_1}\\cap\\overline{\\mathfrak{h}_2}=\\emptyset$ and a nowhere-dense halfspace $\\mathfrak{k}$ is transverse to both $\\mathfrak{h}_i$. Pick points $y_i\\in\\mathfrak{h}_i\\cap\\mathfrak{k}^*$ and observe that $I:=I(y_1,y_2)\\subseteq\\mathfrak{k}^*$; since $\\mathfrak{k}$ is closed by Proposition~\\ref{all about halfspaces}, we have $d(I,\\mathfrak{k})>0$. Thus, if $(x_1,x_2)$ is a pair of gates for $(I,\\mathfrak{k})$, the set $\\mathscr{H}(x_1|x_2)$ has positive measure and it contains a thick halfspace $\\mathfrak{k}'$. It is easy to see that $\\mathfrak{k}'$ is transverse $\\mathfrak{h}_1$ and $\\mathfrak{h}_2$.\n\\end{proof}\n\n\\begin{thm}\\label{strong separation}\nIf $\\Gamma\\curvearrowright X$ is Roller minimal and without wall inversions, the following are equivalent:\n\\begin{enumerate}\n\\item $X$ is irreducible;\n\\item there exists a pair of strongly separated halfspaces;\n\\item for every $\\mathfrak{h}\\in\\mathscr{H}\\setminus\\mathscr{H}^{\\times}$, there exist halfspaces $\\mathfrak{h}'\\subseteq\\mathfrak{h}\\subseteq\\mathfrak{h}''$ so that $\\mathfrak{h}'$ and $\\mathfrak{h}''^*$ are thick and strongly separated.\n\\end{enumerate}\n\\end{thm}\n\\begin{proof}\n3 clearly implies 2 and 1 follows from 2 using Corollary~\\ref{products}. We are left to prove that 1 implies 3. Suppose for the sake of contradiction that, for some $\\mathfrak{h}\\in\\mathscr{H}\\setminus\\mathscr{H}^{\\times}$, we cannot find $\\mathfrak{h}'$ and $\\mathfrak{h}''$. We reach a contradiction as in the proof of Proposition~5.1 in \\cite{CS} once we construct sequences $(\\mathfrak{h}_n')_{n\\geq 0}$, $(\\mathfrak{h}_n'')_{n\\geq 0}$ and $(\\mathfrak{k}_n)_{n\\geq 0}$ of thick halfspaces such that\n\\begin{enumerate}\n\\item $\\mathfrak{k}_n$ is transverse to $\\mathfrak{h}_{n-1}'$ and $\\mathfrak{h}_{n-1}''$ for $n\\geq 1$;\n\\item $\\mathfrak{k}_n\\in\\mathscr{H}(\\mathfrak{h}_n''^*|\\mathfrak{h}_n')$ for $n\\geq 0$;\n\\item $\\mathfrak{h}_n'\\subsetneq\\mathfrak{h}_{n-1}'\\subsetneq\\mathfrak{h}\\subsetneq\\mathfrak{h}_{n-1}''\\subsetneq\\mathfrak{h}_n''$ for $n\\geq 1$.\n\\end{enumerate}\nBy Corollary~\\ref{double skewering}, we can find $g\\in\\Gamma$ such that $g^{-1}\\mathfrak{h}\\subsetneq\\mathfrak{h}\\subsetneq g\\mathfrak{h}$ and we set $\\mathfrak{h}_0':=g^{-1}\\mathfrak{h}$ and $\\mathfrak{h}_0'':=g\\mathfrak{h}$. Now suppose that we have defined $\\mathfrak{h}_n'$, $\\mathfrak{h}_n''$ and $\\mathfrak{k}_{n-1}$. Corollary~\\ref{double skewering} yields $g'\\in\\Gamma$ with $\\mathfrak{h}_n'\\subsetneq\\mathfrak{h}\\subsetneq\\mathfrak{h}_n''\\subsetneq g'\\mathfrak{h}_n'\\subsetneq g'\\mathfrak{h}_n''$ and $\\overline{\\mathfrak{h}_n''}\\cap g'\\overline{\\mathfrak{h}_n'^*}=\\emptyset$. By hypothesis, $\\mathfrak{h}_n'$ and $g'\\mathfrak{h}_n''^*$ are not strongly separated, but they have disjoint closures; thus there exists $\\mathfrak{k}$ transverse to $\\mathfrak{h}_n'$ and $g'\\mathfrak{h}_n''$. By Lemma~\\ref{slight reformulation of SS}, we can assume that $\\mathfrak{k}$ is thick. \n\nThe construction of the sequences can be concluded as in \\cite{CS} once we obtain analogues of their Lemmata~5.2,~5.3 and~5.4. Lemmata~5.3 and~5.4 can be proved using Corollary~\\ref{double skewering} as in \\cite{CS}, with the additional requirement that all input and output halfspaces be thick. We prove the following version of Lemma~5.2:\n\\begin{center}\n\\emph{``If $\\mathfrak{h},\\mathfrak{k}$ are thick transverse halfspaces, one of the four sectors determined by $\\mathfrak{h}$ and $\\mathfrak{k}$ contains a thick halfspace.''}\n\\end{center}\nLet $\\mathcal{H}$ be the set of thick halfspaces that are not transverse to $\\mathfrak{h}$ and $\\mathcal{K}$ the set of thick halfspaces that are not transverse to $\\mathfrak{k}$. As in \\cite{CS}, we can assume that every halfspace in $\\mathcal{H}$ is transverse to every halfspace in $\\mathcal{K}$. Let $\\mathcal{H}'$ be the collection of thick halfspaces that either contain or are contained in some halfspace of $\\mathcal{H}$; we define $\\mathcal{K}'$ similarly. \n\nObserve that $\\mathfrak{a}\\in\\mathscr{H}$ lies in $\\mathcal{H}'$ if and only if there exist $\\mathfrak{b},\\mathfrak{b}'\\in\\mathcal{H}$ such that $\\mathfrak{b}\\subseteq\\mathfrak{a}\\subseteq\\mathfrak{b}'$; again, this is proved as in \\cite{CS}. Thus, halfspaces in $(\\mathscr{H}\\setminus\\mathscr{H}^{\\times})\\setminus\\mathcal{H}'$ must be transverse to all halfspaces in $\\mathcal{H}'$. We conclude that we have a $*$-invariant partition\n\\[\\mathscr{H}=\\mathcal{H}'\\sqcup\\left(\\mathscr{H}\\setminus(\\mathcal{H}'\\cup\\mathscr{H}^{\\times})\\right)\\sqcup\\mathscr{H}^{\\times},\\]\nwhere the first two pieces are transverse and the third is null. Since $\\mathfrak{h}\\in\\mathcal{H}'$ and $\\mathfrak{k}\\in\\mathscr{H}\\setminus(\\mathcal{H}'\\cup\\mathscr{H}^{\\times})$ this partition is nontrivial. Finally, observe that $\\mathcal{H}'$ is inseparable and, thus, measurable. Corollary~\\ref{products} now violates the irreducibility of $X$.\n\\end{proof}\n\n\n\n\\section{Facing triples.}\\label{facing triples}\n\nLet $X$ be a complete median space of finite rank $r$ and $\\Gamma\\curvearrowright X$ an isometric action without wall inversions. In this section we study certain tree-like behaviours displayed by all median spaces that admit a Roller nonelementary action. These will allow us to construct nonabelian free subgroups of their isometry groups. \n\nWe say that the median space $X$ is \\emph{lineal} with endpoints $\\xi,\\eta\\in\\overline X$ if $X\\subseteq I(\\xi,\\eta)$. \n\n\\begin{lem}\\label{intervals vs elementarity}\nEvery action on a lineal median space is Roller elementary.\n\\end{lem}\n\\begin{proof}\nThe elements of $\\mathscr{F}:=\\left\\{\\{\\xi,\\eta\\}\\subseteq\\overline X\\mid X\\subseteq I(\\xi,\\eta)\\right\\}\\neq\\emptyset$ are permuted by each isometry of $X$. If $\\{\\xi_1,\\eta_1\\}$, $\\{\\xi_2,\\eta_2\\}$ are distinct elements of $\\mathscr{F}$, the sets $\\mathscr{H}(\\xi_1,\\eta_2|\\eta_1,\\xi_2)$ and $\\mathscr{H}(\\xi_1,\\xi_2|\\eta_1,\\eta_2)$ are transverse and their union is $\\mathscr{H}(\\xi_1|\\eta_1)$, which contains a side of every wall of $X$. By Corollary~\\ref{products}, $X$ splits as a product $X_1\\times X_2$. Thus, if $X$ is irreducible, we have $\\#\\mathscr{F}=1$ and an index-two subgroup of $\\Gamma$ fixes two points of $\\overline X$.\n\nIn general, let $X=X_1\\times ... \\times X_k$ be the decomposition of $X$ into irreducible factors and $\\Gamma$ a group of isometries of $X$; by Proposition~\\ref{isometries of products}, a finite-index subgroup $\\Gamma_0\\leq\\Gamma$ leaves this decomposition invariant. Since $\\overline X=\\overline{X_1}\\times ... \\times\\overline{X_k}$ by Lemma~\\ref{Roller for products}, if $X$ is lineal so is each $X_i$. The previous discussion shows that a finite-index subgroup of $\\Gamma_0$ fixes points $\\xi_i\\in\\overline{X_i}$, for all $i$; in particular, it fixes the point $(\\xi_1,...,\\xi_k)\\in\\overline X$, hence $\\Gamma\\curvearrowright X$ is Roller elementary.\n\\end{proof}\n\nHalfspaces $\\mathfrak{h}_1,\\mathfrak{h}_2,\\mathfrak{h}_3$ are said to form a \\emph{facing triple} if they are pairwise disjoint; if each $\\mathfrak{h}_i$ is thick, we speak of a thick facing triple. If $X$ is lineal, $\\mathscr{H}$ does not contain facing triples. On the other hand, we have the following result; compare with Corollary~2.34 in \\cite{CFI} and Theorem~7.2 in \\cite{CS}.\n\n\\begin{prop}\\label{facing 3-ples exist}\n\\begin{enumerate}\n\\item If $\\Gamma\\curvearrowright X$ is Roller nonelementary, there exists a thick facing triple.\n\\item If $X$ is irreducible and $\\Gamma\\curvearrowright X$ is Roller nonelementary and Roller minimal, every thick halfspace is part of a thick facing triple.\n\\end{enumerate}\n\\end{prop}\n\\begin{proof}\nWe prove part~1 by induction on the rank; the rank-zero case is trivial. In general, let $C\\subseteq Z$ be as provided by Corollary~\\ref{Roller elementary vs strongly so 2}. If ${Z\\subseteq\\partial X}$, we have $\\text{rank}(C)\\leq\\text{rank}(X)-1$ by Proposition~\\ref{components}; in this case, we conclude by the inductive hypothesis and Proposition~\\ref{halfspaces of components}. Otherwise, we have $C\\subseteq X$; let $C=C_1\\times ...\\times C_k$ be its decomposition into irreducible factors. By Proposition~\\ref{isometries of products}, a finite-index subgroup $\\Gamma_0\\leq\\Gamma$ preserves this decomposition and, since $\\overline C=\\overline{C_1}\\times...\\times\\overline{C_k}$, there exists $i\\leq k$ such that $\\Gamma_0\\curvearrowright C_i$ is Roller nonelementary. If $k\\geq 2$, we have $\\text{rank}(C_i)\\leq\\text{rank}(X)-1$ and we conclude again by the inductive hypothesis. If $C$ is irreducible, Corollary~\\ref{double skewering} and Theorem~\\ref{strong separation} provide $\\mathfrak{h}\\in\\mathscr{H}(C)\\setminus\\mathscr{H}^{\\times}(C)$ and $g\\in\\Gamma$ such that $g\\mathfrak{h}$ and $\\mathfrak{h}^*$ are strongly separated. Since $\\overline C$ is compact, there exists a point $\\xi\\in\\overline C$ that lies in the closure of every $g^n\\widetilde{\\mathfrak{h}}$, $n\\in\\mathbb{Z}$; similarly, we can find $\\eta\\in\\overline C$ lying in the closure of every $g^n\\widetilde{\\mathfrak{h}}^*$, $n\\in\\mathbb{Z}$.\n\nBy Lemma~\\ref{intervals vs elementarity}, there exists $x\\in C$ with $m:=m(x,\\xi,\\eta)\\neq x$. Picking $\\mathfrak{j}\\in\\mathscr{H}(m|x)\\setminus\\mathscr{H}^{\\times}(C)$, neither $\\xi$ nor $\\eta$ can lie in $\\widetilde{\\mathfrak{j}}$. Since $g^n\\mathfrak{h}$ and $g^m\\mathfrak{h}^*$ are strongly separated for $n0$, the trap frequency is increased and the two molecules are pushed apart slightly so that their mean separation is larger than in the absence of the dipole-dipole interaction. For $q r^3 < 0$, these effects are reversed.\n\nFigure~\\ref{figSupp:eigs1D} shows the energies of the first 5 eigenstates of Eq.~\\eqref{eqSupp:ham-rel} calculated numerically as a function of $\\tilde{\\delta x}$ for $q=1$ and $r=3.5$. At large separations, the energy shifts agree well with those expected for point dipoles fixed at the potential minima (dashed lines). For intermediate separations, the shifts from the full 1D calculation are larger because the finite extent of the wavefunction means that $\\langle 1\/x_{\\rm rel}^3\\rangle > 1\/\\langle x_{\\rm rel}\\rangle^3$. This effect is larger for excited motional states where the extent of the wavefunction is larger. At small separations, the dipoles are pushed apart by their interaction and so the energy shift is reduced from the value expected from fixed point dipoles. \n\n\\begin{figure}\n \\centering\n \\includegraphics{eigs1D.pdf}\n \\caption{Energies of the first 5 relative motional states in presence of the dipole-dipole interaction for $q=1$, $r=3.5$. Dashed lines: calculations for point dipoles fixed at potential minima; solid lines: full 1D calculation.}\n \\label{figSupp:eigs1D}\n\\end{figure}\n\n\\section{Hyperfine interaction and shifted potentials}\n\nHere, we consider in more detail the complications introduced by the hyperfine interaction. As in the main text, we take the handedness of the light to be along $z$.\n\nThe hyperfine interaction couples the nuclear spin $\\vec{I}$ and the total electronic angular momentum $\\vec{J}$. Their sum is $\\vec{F}$. Let us first consider states with well defined $F$, $J$ and $I$, and a vector Stark shift which is small compared to the hyperfine interaction so that we need only consider the diagonal matrix elements of the effective Stark shift operator. In this case, the vector Stark shift is $W_1 = \\frac{1}{2 \\epsilon_0 c}\\alpha^{(1)} g_F m_F (\\vec{C}\\cdot\\hat{z}) I$ where\n\\begin{equation}\n g_F=\\frac{F(F+1)+J(J+1)-I(I+1)}{4J(J+1)F(F+1)}.\n\\label{eqSupp:gF}\n\\end{equation}\n\nThis is a useful result for molecules where the spin-rotation interaction is large compared to the hyperfine interaction. States from neighboring rotational manifolds that have the same values of $J$, $F$ and $m_F$ will have the same vector Stark shift, and the potentials for these states will be identical. However, for many molecules of interest, the hyperfine and spin-rotation interactions are similar in size so the hyperfine coupling mixes states with the same $F$ and $m_F$ but different $J$. The vector Stark shift of these mixed states is not given by Eq.~(\\ref{eqSupp:gF}), but instead depends on the relative size of the hyperfine and spin-rotation coupling. As a result, in general, states in different rotational levels will have different vector Stark shifts, and potentials that are shifted relative to one another. Here we consider the effect of this shift on the dipole-dipole interaction. \n\nWe assume the $\\ket{0_\\pm}$ states have potential minima at $\\pm \\delta x_0\/2$ and the $\\ket{1_\\pm}$ states at $\\pm \\delta x_1\/2$. The full Hamiltonian is now\n\\begin{equation}\n \\begin{split}\n H =& \\frac{p_A^2}{2M} + \\frac{p_B^2}{2M} + \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_A+\\frac{\\delta x_0}{2}\\right)^2\\sket{0_-}{A}\\sbra{0_-}{A}\\\\\n &\\quad + \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_A+\\frac{\\delta x_1}{2}\\right)^2\\sket{1_-}{A}\\sbra{1_-}{A}\\\\\n &\\quad + \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_B-\\frac{\\delta x_0}{2}\\right)^2\\sket{0_+}{B}\\sbra{0_+}{B}\\\\\n &\\quad + \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_B-\\frac{\\delta x_1}{2}\\right)^2\\sket{1_+}{B}\\sbra{1_+}{B}\\\\\n &\\quad + \\frac{\\vec{d}_A\\cdot\\vec{d}_B-3(\\vec{d}_A\\cdot\\hat{x})(\\vec{d}_B\\cdot\\hat{x})}{4\\pi\\epsilon_0|x_B-x_A|^3}.\n \\end{split}\n\\end{equation}\nThe Hamiltonian is no longer separable into motional and internal parts. We apply a unitary transformation\n\\begin{equation}\n \\begin{split}\n U(\\eta) &= \\Big[T_A(-\\tfrac{\\eta}{2})\\sket{0_-}{A}\\sbra{0_-}{A} + T_A(\\tfrac{\\eta}{2})\\sket{1_-}{A}\\sbra{1_-}{A}\\Big]\\\\\n & \\otimes \\Big[T_B(\\tfrac{\\eta}{2})\\sket{0_+}{B}\\sbra{0_+}{B} + T_B(-\\tfrac{\\eta}{2})\\sket{1_+}{B}\\sbra{1_+}{B}\\Big]\n \\end{split}\n\\end{equation}\nwhere $T_{A\/B}$ are the single particle translation operators such that $T_{A\/B}(\\eta)\\ket{x_{A\/B}}=\\ket{x_{A\/B}+\\eta}$. We find\n\\begin{equation}\n \\begin{split}\n H' &= U(\\delta x_{10}) H U^\\dagger(\\delta x_{10})\\\\\n &= \\frac{p_A^2}{2M} + \\frac{p_B^2}{2M} + \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_A+\\frac{\\delta x_{\\rm av}}{2}\\right)^2\\\\\n &\\quad+ \\frac{1}{2}M\\omega_{\\rm t}^2\\left(x_B-\\frac{\\delta x_{\\rm av}}{2}\\right)^2\\\\\n &\\quad + \\frac{\\Lambda_{10}}{4\\pi\\epsilon_0}\\big[D_A D_B^\\dagger K(\\delta x_{10}) + D_A^\\dagger D_B K^\\dagger(\\delta x_{10})\\\\\n &\\qquad\\qquad+D_A D_B F(\\delta x_{10}) + D_A^\\dagger D_B^\\dagger F^\\dagger(\\delta x_{10})\\big],\n \\end{split}\n\\end{equation}\nwhere $\\delta x_{\\rm av}=\\frac{1}{2}(\\delta x_0+ \\delta x_1)$, $\\delta x_{10}=\\frac{1}{2}(\\delta x_0-\\delta x_1)$, $D_{A} = \\sket{1_-}{A}\\sbra{0_-}{A}$, $D_B = \\sket{1_+}{B}\\sbra{0_+}{B}$ and we have defined the operators\n\\begin{equation}\n \\begin{split}\n K(\\eta) &= T_A\\left(\\tfrac{\\eta}{2}\\right)T_B\\left(\\tfrac{\\eta}{2}\\right)\\frac{1}{|x_B-x_A|^3}T_A^\\dagger\\left(-\\tfrac{\\eta}{2}\\right)T_B^\\dagger\\left(-\\tfrac{\\eta}{2}\\right),\\\\\n F(\\eta) &= T_A\\left(\\tfrac{\\eta}{2}\\right)T_B\\left(-\\tfrac{\\eta}{2}\\right)\\frac{1}{|x_B-x_A|^3}T_A^\\dagger\\left(-\\tfrac{\\eta}{2}\\right)T_B^\\dagger\\left(\\tfrac{\\eta}{2}\\right).\n \\end{split}\n\\end{equation}\nWe can immediately neglect, as before, the off-resonant terms in $D_A D_B$ and $D_A^\\dagger D_B^\\dagger$ because they couple internal states which are separated by the rotational energy.\nTransforming again to the dimensionless relative position operators we have\n\\begin{equation}\n \\begin{split}\n \\tilde{H}' &= \\frac{1}{\\hbar\\omega_{\\rm t}} H' = \\frac{p_{\\rm cm}^2}{2} + \\frac{p_{\\rm rel}^2}{2} + \\frac{1}{2} x_{\\rm cm}^2 + \\frac{1}{2} (x_{\\rm rel}-\\tilde{\\delta x}_\\mathrm{av})^2 \\\\&\\quad +\\frac{r^3}{|x_{\\rm rel}|^3}\\big[T_{\\rm cm}(2\\xi)D_A D_B^\\dagger + T_{\\rm cm}(-2\\xi)D_A^\\dagger D_B\\big],\n \\end{split}\n \\label{eqSupp:red-mot-ham-shift}\n\\end{equation}\nwhere $\\xi = \\sqrt{\\frac{M\\omega_{\\rm t}}{2\\hbar}}\\delta x_{10}$ and $\\tilde{\\delta x}_\\mathrm{av}=\\sqrt{\\frac{M\\omega_{\\rm t}}{2\\hbar}}\\delta x_\\mathrm{av}$. $T_{\\rm cm}$ and $T_{\\rm rel}$ are the translation operators for the dimensionless center-of-mass and relative coordinates respectively and we have used $T_A(\\frac{\\delta x_{10}}{2}) = T_{\\rm rel}(-\\frac{\\xi}{2})T_{\\rm cm}(\\frac{\\xi}{2})$, $T_B(\\frac{\\delta x_{10}}{2}) = T_{\\rm rel}(\\frac{\\xi}{2})T_{\\rm cm}(\\frac{\\xi}{2})$. In Eq.~\\eqref{eqSupp:red-mot-ham-shift}, the dipole-dipole interaction couples the center-of-mass and relative motions, and has an off-diagonal matrix element between the states $\\ket{\\Psi^+}$ and $\\ket{\\Psi^-}$.\n\nWe note that $\\tilde{H}' = \\tfrac{1}{\\hbar \\omega_{\\rm t}}H_{\\rm m} +\\delta H$ where $H_{\\rm m}$ is given by Eq.~(\\ref{eqSupp:ham-mot-red}) and\n\\begin{equation}\n\\begin{split}\n \\delta H =& \\frac{r^3}{|x_{\\rm rel}|^3}\\big[T_{\\rm cm}(2\\xi)D_A D_B^\\dagger+ T_{\\rm cm}(-2\\xi)D_A^\\dagger D_B\\big]\\\\ &- \\frac{r^3}{|x_{\\rm rel}|^3}\\big[D_A D_B^\\dagger + D_A^\\dagger D_B\\big].\n \\end{split}\n\\end{equation}\nTaking zeroth-order eigenstates to be those of $H_{\\rm m}$, and using first-order perturbation theory, we find that the dipole-dipole energies are just multiplied by the factor $e^{-\\xi^2}$. This factor is used in the calculation of the dipole-dipole interaction in the main text. It accounts for the shifted potentials irrespective of the size of the dipole-dipole interaction because the center-of-mass eigenstates of Eq.~\\eqref{eqSupp:ham-cm} are unchanged by the dipole-dipole interaction.\n\n\\section{Tunneling}\n\nStates that have total angular momentum $F>1\/2$ will be subject to a tensor ac Stark shift. This has several effects. One is to make the trap frequencies for different states differ from each other. For the parameters considered in this work, this effect is small. The most important effect is to give an off-diagonal term that couples together states with $\\Delta m_F \\le 2$. For pairs of states that are degenerate at $x=0$, this introduces an avoided crossing and provides a mechanism for molecules to tunnel from one potential to the other. \n\nLet $a$ be the matrix element of the tensor part of the Stark shift operator between the pair of states, and assume that this is constant across the region of interest. The single-molecule tunneling rate is\n\\begin{equation}\n \\gamma_\\mathrm{t} \\simeq 2 |a| \\cusbraket{\\phi_-}{\\phi_+}.\n\\end{equation}\nwhere $\\ket{\\phi_-}$ and $\\ket{\\phi_+}$ are the motional states corresponding to the pair of internal states. If we assume harmonic oscillator ground states, this is $2 |a| e^{-\\tilde{\\delta x}^2\/2}$. \n\nIn the realistic example described in the main text, there is no tunneling because we choose orthogonal tweezer polarizations so that $a=0$ for all pairs of states. If instead we choose parallel polarizations, there can be tunelling between the $\\ket{1_\\pm}$ states with $|a|=\\SI{1.4}{\\mega\\hertz}$. Taking the same tweezer parameters used in the main text, $\\delta x$ for this pair of states is \\SI{175}{\\nano\\meter}, and $\\gamma_{\\rm t}$ is \\SI{2.6}{\\kilo\\hertz}.\n\n\\section{Photon scattering rate}\n\nThe scattering rate is dominated by the vector tweezer since it is tuned much closer to resonance than the scalar tweezer. The scattering rate from light tuned to the midpoint of the fine structure interval is dominated by scattering from these two levels and is well approximated by,\n\\begin{equation}\n R_\\mathrm{ph} = \\frac{2\\Gamma\\Omega^2}{3\\delta_{\\rm fs}^2}\n\\end{equation}\nwhere $\\Omega=d_{AX}\\sqrt{2 I\/\\epsilon_0 c}\/\\hbar$ is the Rabi frequency and $\\Gamma$ is the linewidth of the $^2\\Pi$ state. For CaF we have $\\Gamma=2\\pi\\times \\SI{8.3}{\\mega\\hertz}$, $\\delta_{\\rm fs}=2\\pi\\times\\SI{2.14}{\\tera\\hertz}$ and $d_{AX}=0.97\\times\\SI{5.95}{\\debye}$ where the first factor is the Franck-Condon factor and the second is the transition dipole moment between electronic states. \n\n\\section{Collisional loss rate}\n\nThe collisional loss rate for two molecules with wavefunctions $\\psi_A(x)$ and $\\psi_B(x)$ is\n\\begin{equation}\n R_{\\rm col} = \\beta \\int |\\psi_A(x)|^2|\\psi_B(x)|^2 \\mathrm{d}^3 x\n\\end{equation}\nwhere $\\beta$ is the two-body loss rate constant, recently measured for CaF in \\SI{780}{\\nano\\meter} tweezer traps \\cite{Cheuk2020}. For two molecules in the motional ground states of two displaced but otherwise identical potential wells, this is\n\\begin{equation}\n R_{\\rm col} = \\beta \\left(\\frac{m}{2 \\pi\\hbar}\\right)^\\frac{3}{2} \\omega_{\\rm r} \\omega_{\\rm a}^\\frac{1}{2} e^{-\\tilde{\\delta x}^2}\n\\end{equation}\nwhere $\\omega_{\\rm r}$ is the trap frequency in the radial direction and $\\omega_{\\rm a}$ is the trap frequency in the axial direction.\n\nWe find that, for CaF in a trap that has $\\omega_{\\rm r}=2\\pi\\times\\SI{200}{\\kilo\\hertz}$, $\\omega_{\\rm a}=2\\pi\\times\\SI{35}{\\kilo\\hertz}$, keeping the collisional loss rate below \\SI{1}{\\hertz} requires a separation of 4.7 oscillator lengths, or \\SI{140}{\\nano\\meter}. The rate is very sensitive to separation in this region -- decreasing the separation to 3.6 harmonic oscillator lengths (or \\SI{106}{\\nano\\meter}) increases the loss rate to \\SI{100}{\\hertz}.\n\n\\section{Transport}\n\n\\begin{figure}\n \\centering\n \\includegraphics{transport-c2.pdf}\n \\caption{Trap merge sequence. (a) Intensity ramps of the different tweezers used in the sequence. (b) Separation of the potential minima as a function of time. Top row shows snapshots of potentials at three different times in the sequence.}\n \\label{figSupp:transport}\n\\end{figure}\n\nFigure~\\ref{figSupp:transport} illustrates a simple sequence to bring a pair of CaF molecules from two separated potentials into a single, state-dependent trap ready for the fast two-qubit gate. The adiabatic transport is achieved with intensity ramps of four spatially-fixed tweezer traps as shown in Fig.~\\mref{figSupp:transport}{(a)}. The top row of the figure shows the potentials at three points during the merger. The molecules begin in two \\SI{780}{\\nano\\meter} tweezers focused at $x=\\pm\\SI{0.6}{\\micro\\meter}$, each having power $P_{\\rm sep}$. A \\SI{604.966}{\\nano\\meter} tweezer and another \\SI{780}{\\nano\\meter} tweezer are focused at $x=0$ and have powers $P_{\\rm vec}$ and $P_{\\rm sc}$ respectively. $P_{\\rm sep}$ is ramped down from its initial value of $\\SI{10}{\\milli\\watt}$ while $P_{\\rm vec}$ is ramped up (note that $P_{\\rm vec}$ is shown multiplied by 20 to appear on same scale). Finally $P_{\\rm sc}$ is ramped up to squeeze the two molecules together. Figure~\\mref{figSupp:transport}{(b)} shows the separation of the trap minima as a function of time. The chosen power ramps keep the trap frequency fixed throughout. The mean number of photons scattered during this transport sequence is \\num{1.6e-2} and the probability of motional excitation is smaller still. More sophisticated non-adiabatic sequences will allow for faster transport and fewer scattered photons.\n\n\n\\end{document}","meta":{"redpajama_set_name":"RedPajamaArXiv"}}