%\documentclass{uai2022} % for initial submission
\documentclass[accepted]{uai2022} % after acceptance, for a revised
                                    % version; also before submission to
                                    % see how the non-anonymous paper
                                    % would look like
%% There is a class option to choose the math font
% \documentclass[mathfont=ptmx]{uai2022} % ptmx math instead of Computer
                                         % Modern (has noticable issues)
% \documentclass[mathfont=newtx]{uai2022} % newtx fonts (improves upon
                                          % ptmx; less tested, no support)
% NOTE: Only keep *one* line above as appropriate, as it will be replaced
%       automatically for papers to be published. Do not make any other
%       change above this note for an accepted version.



%% Choose your variant of English; be consistent
\usepackage[american]{babel}
% \usepackage[british]{babel}

%% Some suggested packages, as needed:
% \usepackage{natbib} % has a nice set of citation styles and commands
%     \bibliographystyle{plainnat}
%     \renewcommand{\bibsection}{\subsubsection*{References}}
\usepackage{mathtools} % amsmath with fixes and additions
% \usepackage{siunitx} % for proper typesetting of numbers and units
\usepackage{booktabs} % commands to create good-looking tables

%% Provided macros
% \smaller: Because the class footnote size is essentially LaTeX's \small,
%           redefining \footnotesize, we provide the original \footnotesize
%           using this macro.
%           (Use only sparingly, e.g., in drawings, as it is quite small.)

%% Self-defined macros
\usepackage[dvipsnames]{xcolor}

\usepackage{amssymb,amsfonts,amsmath,amsthm} %ams
\usepackage{enumerate,enumitem,tikz,graphicx,mathrsfs,eucal,verbatim, bbm, derivative}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{graphbox} 
\usepackage{comment}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{nicefrac}
\usepackage{array}
\usepackage{hyperref}

\newcommand{\swap}[3][-]{#3#1#2} % just an example


\usepackage[strict]{changepage}
\usepackage{manfnt}
\usepackage{multicol}
 \usepackage[
    backend=biber,
    style=authoryear,
  ]{biblatex}
\addbibresource{polianskii_188.bib}

\let\svthefootnote\thefootnote
\newcommand\freefootnote[1]{%
  \let\thefootnote\relax%
  \footnotetext{#1}%
  \let\thefootnote\svthefootnote%
}

\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{prb}[thm]{Problem}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]

\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}


\newcommand{\blue}{\color{blue}}
\newcommand{\green}{\color{green!50!black}}  
\newcommand{\red}{\color{red}}  

\newcommand{\centered}[1]{\begin{tabular}{l} #1 \end{tabular}}
\newcommand{\kw}[1]{{\bfseries #1}}
% \newcommand{\la}{\langle}
% \newcommand{\ra}{\rangle}
\newcommand*\rfrac[2]{{}^{#1}\!/_{#2}}
\newcommand{\inner}[2]{\left\langle #1 , #2 \right\rangle}

\newcommand{\ssize}{|\Sigma|} % r
\newcommand{\ssizeopt}{} % $r$

\DeclareMathOperator{\vol}{\textnormal{Vol}}
\DeclareMathOperator{\diam}{diam}




\title{Voronoi Density Estimator for High-Dimensional Data: \\ Computation, Compactification and Convergence \\
(Supplementary Material)}

% The standard author block has changed for UAI 2022 to provide
% more space for long author lists and allow for complex affiliations
%
% All author information is authomatically removed by the class for the
% anonymous submission version of your paper, so you can already add your
% information below.
%
% Add authors 
% {\href{mailto:<vpol@kth.se>?Subject=Your UAI 2022 paper}

\author[1]{{\href{mailto:<vpol@kth.se>?Subject=Your UAI 2022 paper}{Vladislav Polianskii*}}}
\author[1]{{\href{mailto:<glma@kth.se>?Subject=Your UAI 2022 paper}{Giovanni Luca Marchetti*}}}
\author[1]{Alexander Kravberg}
\author[ ]{Anastasiia Varava}
\author[1]{Florian~T.~Pokorny}
\author[1]{Danica Kragic}
% Add affiliations after the authors
\affil[1]{%
    School of Electrical Engineering and Computer Science, Royal Institute of Technology (KTH)\\
    Stockholm, Sweden
}




\begin{document}
\onecolumn
\maketitle
    
    
\section*{}
\freefootnote{*Equal contribution.}

We provide here a proof of our main theoretical result with full details. 

\setcounter{section}{4}
\begin{thm}\label{convergence}
Suppose that $\rho$ has support in the whole $\mathbb{R}^n$. For any $K \in L^1(\mathbb{R}^n \times \mathbb{R}^n)$ the sequence of random probability measures $\mathbb{P}_m = f \textnormal{d}x$ defined by the CVDE with $m$ generators converges to $\mathbb{P}$ in distribution w.r.t. $x$ and in probability w.r.t. $P$.  Namely, for any measurable set $E \subseteq \mathbb{R}^n$ the sequence $\mathbb{P}_m(E)$ of random variables over $P$ sampled from $\rho$ converges in probability to the constant $\mathbb{P}(E)$.
\end{thm}
% We summarise here the main steps of the proof and refer to the appendix for full details. $\mathbb{P}_m(E)$ is given by the normalised number of
% generators whose Voronoi cell is contained in $E$ (which tends to $\mathbb{P}(E)$ by the law of large numbers) plus a residue bounded by the number of generators intersecting the boundary $\partial E$. Assuming $E$ is bounded, we follow an argument similar to \cite{devroye} and prove that the maximum diameter of a Voronoi cell intersecting $\partial E$ goes to $0$ in probability. It follows that the number of cells intersecting $\partial E$ goes to zero as well, assuming $\partial E$ is negligible, which is possible by the Portmanteu Lemma.    

We shall first build up some machinery necessary for the proof. First of all, the following fact on higher-dimensional Euclidean geometry will come in hand. 

\begin{prop}\label{euclideanlemma}
\textnormal{(\cite{vorvolumes}, Lemma 5.3)} Let $x \in \mathbb{R}^n$, $\delta > 0$. There exist constants $1 < c_1 < c_2 - 1 < 31 $ such that for any open cone $K \subseteq \mathbb{R}^n$ centered at $x$ of solid angle $\frac{\pi}{12}$ and any $p, q, z \in K$, if 
$$ d(x,p)< \delta, \ c_1 \delta \leq d(x,q)  < c_2 \delta, \ d(x,z)\geq 32 \delta $$
then $d(z,q) < d(z,p)$.
\end{prop}

\begin{figure}[h!]
\centering
\includegraphics[width=.4\linewidth]{paper_picture.png}
\caption{Graphical depiction of sets and points appearing in the proof of Proposition \ref{shelling}.}
\end{figure}

We can now deduce the following.

\begin{prop}\label{shelling}
Let $\emptyset \not = E \subseteq \mathbb{R}^n$ be a bounded measurable set. There exists a bounded measurable set $B \supseteq E$ such that as $m = |P|$ tends to $\infty$, the probability with respect to $P \sim \rho^m$ that every Voronoi cell intersecting $E$ is contained in $B$ tends to $1$. 
\end{prop}

\begin{proof}
Let  $\delta =  2 \textnormal{diam}\ E =   2 \sup_{x,y \in E} d(x,y)$ be twice the diameter of $E$. For $L > 0$, consider the $L$-neighbourhood of $E$ 
$$ E_L =  \{ x \in X \ | \ d(x, E) < L \}. $$
First of all, if $E$ has vanishing measure, we can replace it without loss of generality by some $E_L$, which has nonempty interior. 

We claim that $B = E_{32\delta}$ is as desired. To see that, consider an arbitrary $x \in E$ and let $\{K_j \}_j$ be a finite minimal set of open cones centered at $x$ of solid angle $\frac{\pi}{12}$ whose closures cover $\mathbb{R}^n$. As $m$ tends to $\infty$, since $\rho$ has support in the whole $\mathbb{R}^n$, by the law of large numbers the probability of the following tends to $1$:
\begin{itemize}
    \item $P$ intersects $E$ (recall that $E$ has non-vanishing measure),
    \item for every $j$, $P$ intersects $(E_{(c_2 - \frac{1}{2} )\delta} \setminus E_{c_1\delta}) \cap K_j $, where $c_1, c_2$ are the constants from Proposition \ref{euclideanlemma}.
    
\end{itemize}

To prove our claim, we can thus conditionally assume the above. Consider now a Voronoi cell intersecting $E$ and suppose by contradiction that $z$ is an element of the cell not contained in $B$. Let $q \in P$ be a generator in $(E_{(c_2- \frac{1}{2})\delta} \setminus E_{c_1\delta}) \cap K_j $ where $K_j$ is the cone containing $z$.  Since $P$ intersects $E$, the generator $p$ of the cell lies in $E_{\textnormal{diam}(E)} = E_{\frac{\delta}{2}}$ and consequently $d(x,p) < \delta$. If $p \not \in K_j$, then one can replace it with its orthogonal projection on the line passing through $x$ and $z$. The hypotheses of Proposition \ref{euclideanlemma} are then satisfied and we conclude that $d(z,q) < d(z,p)$. This is absurd since $p$ is the generator of $C(z)$.  
 \end{proof}

For a bounded measurable set $E \subseteq \mathbb{R}^n$, denote by 
$$D_E = \max_{\substack{p \in P \\ C(p) \cap E \not = \emptyset}} \textnormal{diam} \ C(p)$$
the maximum diameter of a Voronoi cell intersecting $E$.  


\begin{prop}\label{diameters}
$D_E$, thought as a random variable in $P$, converges in probability to $0$ as $m = |P|$ tends to $\infty$.
\end{prop}

\begin{proof}
The proof is inspired by Theorem~4 in \cite{devroye}. Consider a finite minimal set of open cones $\{K_j \}_j $ centered at $0$ of solid angle $\frac{\pi}{12}$ whose closures cover $\mathbb{R}^n$. Then there is a constant $c > 0$ such that for each $p \in P$
$$ \textnormal{diam} \ C(p) \leq c  \max_j R_{p,j}$$

where $R_{p,j} = \min_{q \in P \cap (p + K_j)} d(p,q) $ denotes the distance from $p$ to its closest neighbour in the cone $K_j$ centered in $p$ (and $R_{p, j} = \infty$ if $P \cap (p + K_j)=  \emptyset$). This follows from Proposition \ref{euclideanlemma} applied with $x = p$ to all the cones centered at the generators, with an opportune $\delta$ for each of them. For each $\varepsilon >0$ we thus have an inclusion of events 

$$\{ D_E > \varepsilon \} \subseteq \left\{ \max_{ \substack{p,j \\ C(p) \cap E \not = \emptyset}} R_{p,j} > \frac{\varepsilon}{c} \right\} \subseteq \bigcup_{i,j} \left\{  P \cap (p_i + K_j) \cap B\left( p_i, \frac{\varepsilon}{c} \right)  = \emptyset  \ \textnormal{and} \ C(p_i)\cap E \not = \emptyset \right\} $$
where $B(x, r)$ is the open ball centered in $x$ of radius $r$. In the above, we assumed that the set $P$ is equipped with an ordering. For $x \in \mathbb{R}^n$ denote by $E_{x,j}$ the event appearing at the right member of the above expression for $x=p_i$. We can then bound the probability with respect to a random $P \sim \rho^m$, with $m = |P|$ fixed, as
$$\mathbb{P}_{P \sim \rho^m}( D_E > \varepsilon  ) \leq \sum_{i,j} \mathbb{P}_{P \sim \rho^m}( E_{p_i,j} ) = m \sum_j \int_{\mathbb{R}^n} \rho(x) \mathbb{P}_{P \sim \rho^m }( E_{x,j} \ | \ p_1 = x) \ \textnormal{d}x.$$

Since the points in $P$ are sampled independently we have

$$\mathbb{P}_{P \sim \rho^m }(E_{x,j} \ | \ p_1 = x, \ C(x) \cap E \not = \emptyset) = \left( 1 - \mathbb{P}\left( (x + K_j) \cap B\left( x, \frac{\varepsilon}{c} \right) \right)  \right)^{m-1} := (1-M(x))^{m-1}.$$


Pick the set $B$ guaranteed by Proposition \ref{shelling}. We can then conditionally assume that every Voronoi cell intersecting $E$ is contained in $B$, which implies $\mathbb{P}_{P \sim \rho^m }(E_{x,j}) = 0 $ for $x \not \in B$. The limit we wish to estimate reduces to 
$$\lim_{m \rightarrow \infty}  m \sum_j \int_{\mathbb{R}^n} \rho(x) \mathbb{P}_{P \sim \rho^m }( E_{x,j} \ | \ p_1 = x) \ \textnormal{d}x = \sum_j \lim_{m \rightarrow \infty} \int_{B} \rho(x) m (1 - M(x))^{m-1} \ \textnormal{d}x.$$

 Since $B$ is bounded and $\rho$ has support in the whole $\mathbb{R}^n$, $M(x)$ is (essentially) bounded from below by a strictly positive constant as $x$ varies in $B$. The limit can thus be brought under the integral and putting everything together we get:    
$$\lim_{m \rightarrow \infty} \mathbb{P}_{P \sim \rho^m}( D_E > \varepsilon  ) \leq \sum_j  \int_{B} \rho(x) \lim_{m \rightarrow \infty} m (1 - M(x))^{m-1} \ \textnormal{d}x = 0. $$
\end{proof}



We are now ready to prove Theorem~\ref{convergence}.
\begin{proof}
 By the Portmanteau Lemma (\cite{van2000asymptotic}), it is sufficient to that $ \mathbb{P}_m(E)$ converges to $\mathbb{P}(E)$ in probability for any bounded measurable set $E \subseteq \mathbb{R}^n$ which is a continuity set for $\mathbb{P}$ i.e., $\mathbb{P}(\partial E) = 0$ where $\partial E$ is the (topological) boundary of $E$. Pick such $E$. By definition of the CVDE, for a fixed set $P$ of generators we have that 
 
 \begin{align}
  \label{bigsum}
  \begin{split}
  \mathbb{P}_m(E) &= \frac{1}{m}| \{ p \in P \ | \  C(p) \subseteq E \} | +
  \overbrace{\frac{1}{m} \sum_{ \substack{p \in P \\ C(p) \not \subseteq E  \\ C(p) \cap E \not = \emptyset  }   }  \frac{\textnormal{Vol}_p(C(p) \cap E)}{\textnormal{Vol}_p(C(p))}}^{\overline{R}} \\
      &= \frac{1}{m} | P \cap E | + \overline{R} - \frac{1}{m}| \{ p \in P \cap E \ | \ C(p) \not \subseteq E  \} |. 
  \end{split}
  \end{align}
Since the Voronoi cells are closed, any cell intersecting $E$ not contained in $E$ intersects $\partial E$. Thus  $\left| \overline{R} - \frac{1}{m}| \{ p \in P \cap E \ | \ C(p) \not \subseteq E  \} | \right| \leq 2R$ where $R :=\frac{1}{m}|\{ p \in P \ | \ C(p) \cap \partial E \not = \emptyset \}|$. Now, the random variable $\frac{1}{m} | P \cap E |$  tends to $\mathbb{P}(E)$ in probability as $m$ tends to $\infty$ by the law of large numbers. In order to conclude, we need to show that $R$ tends to $0$ in probability. 

%  \begin{equation}
%  \label{bigeq}
%  \mathbb{P}_{P \sim \rho^m}(|\mathbb{P}(E) - \mathbb{P}_m(E)| > \varepsilon)  \leq \mathbb{P}_{P \sim \rho^m}\left( \left|\mathbb{P}(E) - \frac{1}{m}|P \cap E |\right| > \frac{\varepsilon}{2} \right) + 
% \mathbb{P}_{P \sim \rho^m}\left( 2R > \frac{\varepsilon}{2} \right).
% \end{equation}

Fix $\varepsilon > 0$. For $L>0$, consider the $L$-neighbour $\partial E_L =  \{ x \in X \ | \ d(x, \partial E) < L \}$ of the boundary $\partial E$. If the diameter of the Voronoi cells intersecting $\partial E$ is less than $L$ then all such cells are contained in $\partial E_L$. Thus:

\begin{align}
\label{finaleq}
 \begin{split}
 \mathbb{P}_{P \sim \rho^m}\left( R > \varepsilon \right) &\leq \mathbb{P}_{P \sim \rho^m}\left( \frac{1}{m} | P \cap \partial E_L| > \varepsilon\ \textnormal{and} \ D_{\partial E} < L  \right) + \mathbb{P}_{P \sim \rho^m}\left( D_{\partial E} \geq  L  \right) \\
  &\leq \mathbb{P}_{P \sim \rho^m}\left( \frac{1}{m} | P \cap \partial E_L| > \varepsilon \right) +\mathbb{P}_{P \sim \rho^m}\left( D_{\partial E} \geq  L  \right) \\
  & \leq \mathbb{P}_{P \sim \rho^m}\left( \left| \mathbb{P}(\partial E_L) - \frac{1}{m} | P \cap \partial E_L| \right| > \varepsilon - \mathbb{P}(\partial E_L) \right) +\mathbb{P}_{P \sim \rho^m}\left( D_{\partial E} \geq  L  \right).
 \end{split}
\end{align}



Since $\partial E$ is closed, $\partial E = \cap_{L > 0} \partial E_L$ and thus $\lim_{L \rightarrow 0} \mathbb{P}( \partial E_L  ) = \mathbb{P}(\cap_L \partial E_L) = \mathbb{P}(\partial E) = 0$ since $E$ is a continuity set. This implies that there is an $L$ such that $\varepsilon >  \mathbb{P}(\partial E_L)$. The right hand side of Equation \ref{finaleq} tends then to $0$ by the law of large numbers and Proposition \ref{diameters}, which concludes the proof.

\end{proof}
    

    \newpage
%\bibliography{references}
\printbibliography
\end{document}