\documentclass{article}

\title{Some Mathematical Preliminaries}
\author{Vladimir Feinberg}

\usepackage{fullpage}

\input{defs}

\begin{document}

\maketitle

\section{Probability Spaces, Random Variables and Stochastic Processes}

This section introduces standard measure theoretic structures, all of which are pretty standard. A couple lemmas and theorems are provided, some of which are definition-related, such as
\href{https://en.wikipedia.org/wiki/Doob%E2%80%93Dynkin_lemma}{Doob-Dynkin}
for conditional expectation and \href{https://en.wikipedia.org/wiki/Kolmogorov_extension_theorem}{Kolmogorov Extension} to be able to construct stochastic processes with prescribed distributions on infinite spaces.

\section{An Important Example: Brownian Motion}

\begin{definition}[Brownian Motion]
  Brownian Motion \(B_t\) is a \(\R^n\)-valued process over \([0,\infty)\) characterized by
  \begin{enumerate}
    \item origin: \(B_0=0\),
    \item independent increments: for any \(t,h\ge 0\), \(B_{t+h}-B_{t}\independent \set{B_s}{s\le t}\)
    \item Gaussian increments: for any \(t,h\ge 0\), \(B_{t+h}-B_{t}\sim N(\vzero, h I)\)
    \item continuous sample paths \(t\mapsto B_t(\omega)\) for almost all \(\omega\in \Omega\).
    \end{enumerate}
  \end{definition}

  The first three can be checked to yield existence of some process via Kolmogorov extension. Via \href{https://en.wikipedia.org/wiki/Kolmogorov_continuity_theorem}{Kolmogorov Continuity Theorem}, one can show that a continuous version of such a process exists.

  \begin{theorem}[Kolmogorov's Continuity Theorem]
    Suppose a stochastic process \(U_t\) on a separable, complete metric space with indices \(t\in S\subset\R^d\) satisfies
    \[
      \E\ha{d(U_x, U_y)^\alpha}\le C\|x-y\|^{d+\beta}\,\,.
    \]
    Then, \(U\) admits a continuous version over \(S\).
    \end{theorem}

The continuity theorem \href{https://almostsuremath.com/2020/10/20/the-kolmogorov-continuity-theorem/}{proof} looks essentially like \href{http://www.stat.yale.edu/~pollard/Books/Mini/Chaining.pdf}{chaining}.
Many other characterizations exist for Brownian Motion, also called a \href{https://en.wikipedia.org/wiki/Wiener_process}{Wiener process}.

\begin{definition}[Off-origin Brownian Motion]
  Denote by \(\P^x\) and \(\E^x\) the laws of off-origin Brownian motion starting at \(B_0=x\).
  \end{definition}

\section{Exercises}

\begin{theorem}[Law of the Unconscious Statistician, LOTUS]
  Consider a rv \(X\) with measure \(\mu\). Then
  \[
    \E g(X) = \int g \d{X_*\P}
  \]
    \end{theorem}
    \begin{proof}
      By change of variables,
      \[\E g(X)=\int_\Omega g\circ X\d{\P}=\int_X g\d{X_*\P}\,\,,\]
    \end{proof}

    Though it seems like a simple one-step formula, LOTUS allows us to actually evaluate expectations. Written as a measure-theoretic expectation, \((X_*\P)(g)\) is defined as a limit of \href{https://en.wikipedia.org/wiki/Simple_function}{simple functions}. This, in turn, simplifies in most cases for Borel \(X\), which
    \href{https://en.wikipedia.org/wiki/Lebesgue%27s_decomposition_theorem}{states}
      that \(\mu=\mu_{\lambda}+\mu_{\delta}+\mu_{\mathrm{singular}}\), where \(\mu_\lambda\) is absolutely continuous with respect to the Lebesgue measure, \(\mu_\delta\) is atomic, and the remaining singular distribution \(\mu_{\mathrm{singular}}\) is quite exceptional: it's basically everything else, which is diffuse measures which admit no Borel subsets of positive Lebesgue measure. An example of the latter is the \href{https://en.wikipedia.org/wiki/Cantor_distribution}{Cantor distribution} (recall the Cantor set is Borel!).

 Actual computation must be proven to be equivalent to familiar forms: for Riemann integrable functions, Lebesgue integration is equal to the city-style integration, but otherwise must be interpreted as the limit of pancake-style integration (\href{https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/RandLintegrals.png/375px-RandLintegrals.png}{visualization}). By \href{https://en.wikipedia.org/wiki/Radon%E2%80%93Nikodym_theorem}{Radon-Nikodym}, given \(\mu_\lambda\) we can compute this analogous integral.

   For the discrete part \(\mu_\delta\) using the probability axioms directly for disjoint sets, integrals are countable sums.

   I don't really know how to compute integrals \(\mu_{\mathrm{singular}}\), since they're not well-characterized. For certain examples such as the Cantor distribution, fractal structure can be leveraged to recover recurrences for expectations (since nonzero singular measures are necessarily uncountable, it's difficult to sum over, but in practice these may come up in \href{https://mathoverflow.net/questions/163325/singular-distributions-applications-and-instances}{game-like} settings).

   \subsection{}

   Let \(X\) be a real-valued function on \(\omega\) with corresponding \(\sigma\)-algbra \(\mcF\) taking on only countably many values \(\{a_k\}\) in \(\R\).
   \subsubsection{}
   \(X\) is a random variable iff \(X^{-1}\ca{a_k}\in\mcF\) for all \(k\). \((\implies)\) is immediate, as the singleton sets are Borel. \((\impliedby)\) as any Borel set contains at most countably many \(a_k\) singletons, whose preimage unions must then also be in \(\mcF\).
   \subsubsection{}
   The rest of the problem follows from LOTUS.
   \subsection{}
   For a real rv \(X\) define its distribution function as \(F(x)=\P\ca{X\le x}\).
   \subsubsection{}
   By definition of a measure, \(F\) goes from \(0\) to \(1\) across the number line and is bounded by the two in between. The limiting properties hold by considering the nested sets and monotone convergence of \(\bigcup_{x=1}^\infty\ca{X\le x}=\Omega\).
     \subsubsection{}
     \(F\) is increasing as measures are monotonic over their events.
     \subsubsection{}
     \(F\) is rc (right continuous), again because of nested set limits \(\bigcap_{y>x}\ca{X\le y}=\ca{X\le x}\). Notice left continuity does {\em not} hold analogously.

     \subsection{}
     Let \(\ca{\mcF_i}_{i\in I}\) be a family of \(\sigma\)-algebras. Their intersection is then also a \(\sigma\)-algbra. This holds immediately because all \(\sigma\)-algebra properties are of the form \(\forall j\in J\,\,B_j\in \mcF\implies B\in \mcF\) for various index sets \(J\). This is invariant under intersection.

     \subsection{}
     Chebyshev's inequality \(\P\ca{|X|\ge\lambda}\le \frac{\E\abs{X}^p}{\lambda^p}\) follows for \(p>0\) from
     \[
       \E\abs{X}^p\ge\int_{X>\lambda}\abs{X}^pd\P=\lambda^p \int_{X>\lambda}\frac{\abs{X}^p}{\lambda^p}d\P\ge \lambda^p \int_{X>\lambda}d\P=\lambda^p\P\ca{X>\lambda}
     \]
     Then an MGF inequality stating that \(M=\E\exp\pa{k\abs{X}}<\infty\) implies \(\P\ca{X\ge\lambda}\le M\exp(-k\lambda)\) may be proven the same way.

     \subsection{}
     Let \(X\independent Y\). Then \(\E\ha{XY}=\E X\E Y\). As described in the exercise, by monotone convergence it suffice to consider simple functions \(X=\sum_ia_i1_{A_i},Y=\sum_jb_j1_{B_j}\) where \(\sigma(X)\independent\sigma(Y)\) implies \(\P\pa{A\cap B}=\P A\P B\). Then the discrete expectation factors as desired.

     \subsection{}
     The Borel-Cantelli lemma states that for \(n\in\N\), events \(A_n\) such that \(\sum_n \P A_n<\infty\), \(\P\bigcap_m B_m=0\) where \(B_m=\bigcup_{n=m}^\infty A_n\). To show this, note by measure continuity that \(\P\bigcap_m B_m=\lim_m\P B_m\). Then by union bound, \(\P B_m\le \sum_{n=m}^\infty \P A_n\rightarrow 0\) where the latter tends to \(0\) in \(m\) because the sum of probabilities must converge.

     \subsection{}
     \subsubsection{}
     A Dynkin system made of unions of a finite partition \(G_i\) of \(\Omega\) is a \(\sigma\)-algebra is necessarily a \(\pi\)-system and thus a \(\sigma\)-algebra by the \(\pi\)-\(\lambda\) theorem because the intersection of union of disjoint sets is just the union of the common sets.

     \subsubsection{}

     Any finite \(\sigma\)-algebra on \(\Omega\) is a Dynkin system of a finite partition.

     Given a \(\sigma\)-algebra \(\mcF\), consider \(P=\set{G\in\mcF}{\not\exists H\in\mcF,H\neq\emptyset, H\subset G}\). \(P\) must be disjoint, since otherwise assume for contradiction it contains nondisjoint \(G,H\). As \(G\cap H\in \mcF\) we have a contradiction, as both \(G,H\) are in \(P\) yet they do not meet its non-containment property. On the other hand, \(P\) is a partition, because any \(\omega\in \Omega\) absent from all \(G\in P\) is present in \(\Omega\setminus \bigcup_{G\in P}G\in\mcF\), which must itself be \(P\), a contradiction. Finally, \(P\) generates \(\mcF\): any \(F\in\mcF\) must be covered by some subset of the partition \(J\subset P\). Consider any such cover with the smallest cardinality such that union \(U=\bigcup_{j\in J}G_j\) satisfies \(F\subset U\). Then consider \(U\setminus F\), if this is empty then we have shown that all sets in \(\mcF\) are generated by unions of \(P\). So assume for contradiction it is nonempty. This difference must be covered by some \(G_j\) for fixed \(j\in J\). But \(G_j\) must be disjoint with \(F\), since otherwise it contains the \(U\setminus F\in\mcF\) set, violating its membership with \(P\). This contradicts the minimality of \(U\), which could do without \(G_j\).
\label{basis}
     \subsubsection{}

     Suppose \(X\) is a real-valued random variable on \((\Omega,\mcF,\P)\). If \(\mcF\) is finite then then show \(X\) has a finite image.

     By Sec.~\ref{basis}, we can find a finite partition \(P=\{F_i\}\) which generates \(\mcF\) with Dynkin completion. Consider for any fixed \(i\) two \(\omega_1,\omega_2\in F_i\). If \(X(\omega_1)\neq X(\omega_2)\) then \(A_1=f_i\cap X^{-1}X\{\omega_1\},A_2=F_i\cap X^{-1}X\{\omega_2\}\) are disjoint and in \(\mcF\). Yet as subsets of \(F_i\) they cannot be recovered by a Dynkin completion of \(P\). Thus, \(\card{X F_i}=1\) for all \(i\), so \(\card{X \Omega}\le\sum_i\card{XF_i}<\infty\).

     \subsection{}
     Let \(W_t\) be 1-dimensional Brownian motion from the origin.
     \subsubsection{}
     Recall that the multivariate CF for \(x\)-origin \(d\)-dimensional Brownian motion at a collection of times \(t_1,\cdots,t_k\) is given by the following function of \(k\) vectors \(u_j\in\R^d\):
     \[
       \E\exp\pa{\i\sum_{j=1}^ku_j^\top B_{t_j}}=\exp\pa{\i\sum_j x^\top u_j-\frac{1}{2}\sum_{j_1=1}^d\sum_{j_2=1}^d t_{j_1\land j_2}u_{j_1}^\top u_{j_2}}
     \]

     Thus in our 1-dimensional case, \(\E\exp\pa{\i u W_t}=\exp\pa{-\frac{1}{2}u^2t}\)
     \subsubsection{}

     As \(\exp\) is entire, it is perfectly formal to rewrite the power series like so:
     \[
\E\exp\pa{\i u W_t}=\E\sum_{k=0}^\infty\frac{(\i u W_t)^k}{k!}\,\,,
       \]
     where strictly speaking the measure integration performed by \(\E\) is really performing two separate real integrals, and the extension to \(\C\) can be viewed like sugar for \(\E=\E \MyRe + \i\E\MyIm\). Then we may do some limit exchanges,
     \[
       \partial_u\E\sum_{k=0}^\infty\frac{(\i u W_t)^k}{k!}
       =\E\partial_u\sum_{k=0}^\infty\frac{(\i u W_t)^k}{k!}
       =\E\sum_{k=0}^\infty\partial_u\frac{(\i u W_t)^k}{k!}
       \,\,,
       \]
       justified by Dominated Convergence Theorem (as for real arguments \(u W_t\), \(\exp(\i u W_t)\) is on the unit circle) and then absolute convergence, which is really itself a form of dominated convergence.

       Given the setup above, we may take several derivatives:
       \[
         \partial_u^{2k}\E\exp\pa{\i u W_t}\big|_{u=0}=\E\ha{\i^{2k}W_t^{2k}}\,\,,
       \]
       which setting equal to \(\partial_u^{2k}\exp\pa{-\frac{1}{2}u^2t}\big|_{u=0}=(-1)^k\frac{(2k)!t^k}{2^k\cdot k!}\) yields a formula for the \((2k)\)-th moment (and thus satisfies the condition for Kolmogorov Continuity).
       \subsubsection{}
       The above was completely formal, so the non-characteristic proof is superfluous.
       \subsection{}
       Kolmogorov Extension may give rise to non-continuous versions, since even agreement in distribution (and therefore any finite-dimensional distribution of a subset of a process' indices) can be equivalent while path properties differ.

       Consider a probability space on \(\Omega=[0,\infty)\) with Borel \sa and any diffuse measure \(\mu\). We can define two processes on \([0,\infty)\), \(Y_t=0\) and \(X_t(\omega)=1\ca{t=\omega}\). Notice the processes are equal in law. By disjointness and measure properties,
       \[\P\ca{X_{t_1}\in A_1,\cdots, X_{t_k}\in A_k}=\P\ca{X_{t_1}^{-1}A_1\setminus t_1,\cdots, X_{t_k}\in A_k}+\P\ca{\omega= t_1,\cdots, X_{t_k}\in A_k}\,\,.\]
       But \(\P\ca{\omega = t_1,\cdots, X_{t_k}\in A_k}\le \P\ca{\omega = t_1}=0\) as \(\mu\) is diffuse, so by repeating the same reasoning across the other indices, the original expression
       \[
         \P\set{X_{t_i}\in A_i}{i\in[k]}=\P\set{X_{t_i}^{-1}A_i\setminus t_i}{i\in[k]}=1\ca{\forall i\in[k],\,\,0\in A_i}=\P\set{Y_{t_i}\in A_i}{i\in[k]}
       \]
       \subsection{}

       Brownian motion has stationary increments, which follows immediately from translation invariance of Brownian motion.

       \subsection{}
       \(d\)-dimensional Brownian motion \(B_t\) is equal to \(B_t=(B_t^{(1)},\cdots,B_t^{(d)})\) \(d\) components of independent 1-dimensional Brownian motion. This follows from the CF of \(B_t\), which factors componentwise for any finite set of indices \(t_1,\cdots,t_k\), proving independence, and that components have the same Brownian process law.

       \subsection{}
       \label{translate}

       For any \(t_0\ge 0\), \(B_{t_0+t}-B_{t_0}\) is Brownian motion. This follows immediately from checking the Brownian motion characterization above.

       \subsection{}
       Let \(D_\rho\) be the origin-centered disc of radius \(\rho\) in \(\R^2\). then \(\P^0\ca{B_t\in D_\rho }=\P\ca{\chi^2_2\le \rho^2/t}=1-\exp\frac{-\rho^2}{2t}\)

       \subsection{}
       Prove that the Green measure on \(\R^n\) with respect to \(B_t\), \(K\mapsto\E\int 1\ca{B_t\in K}\d{t}\) is absolutely continuous with respect to the Lebesgue measure.

       The interior integral cannot be easily dominated, so interchange is difficult, but Fubini's Theorem merely requires \(\sigma\)-finite measures, which the Lebesgue measure \(\d{t}\) is. Thus by Fubini,
       \[
         \E\int 1\ca{B_t\in K}\d{t}=\int \d{t}\int \d{\P} 1\ca{B_t\in K}=\int \d{t}\int_K \d{\pa{(B_t)_*\P}} =0\,\,,
       \]
       since the pushforward measure \(\pa{(B_t)_*\P}\) is diffuse.

       \subsection{}

       \(UB_t\) is Brownian motion for unitary \(U\), most easily shown here by the fact that all components remain independent normals.

       \subsection{}

       For \(c>0\), \(\frac{1}{c}B_{c^2t}\) is Brownian motion, which follows immediately from checking the properties of Brownian motion. The scaling \(1/c\) is squared so variance is preserved.
       \subsection{}

       Define the \(p\)-th variation process fora continuous stochastic process \(X_t\) as
       \[
         [X]_t^{(p)}(\omega)=\lim_{n\rightarrow\infty}\sum_{t_k^{(n)}}\abs{X_{t_{k+1}^{(n)}}(\omega)-X_{t_k^{(n)}}}^p\,\,,
       \]
       where the limit is taken over any increasingly fine splits with \(\delta_k^{(n)}=t_{k+1}^{(n)}-t_{k}^{(n)}\) where \(0= t_1^{(n)} \le t_2^{(n)}\le\cdots\le  t_n^{(n)}=t\). Note that this construction intentionally permits duplicates. Call such sequences split sequences.
       \([X]_t^{(1)}\) is referred to as the total variation process and \([X]_t^{(2)}=[X]_t\) as the quadratic variation process.

       \begin{definition}[Shrinking Property]
         A split sequence \(\ca{t_k^{(2)}}_{k=1}^2,\cdots,\ca{t_k^{(n)}}_{k=1}^n,\cdots\) is {\em shrinking} if \[\lim_n\max_k\delta_k^{(n)}=0\,\,.\]
       \end{definition}

       Note that by continuity on a compact interval \([0, t]\), \(t\mapsto X_t(\omega)\) is uniformly continuous.

       \begin{lemma}[Partition Invariance]
         Fix \(\omega\) and let \(\Delta_k^{(n)}(t)=\abs{X_{t_{k+1}}^{(n)}(\omega)-X_{t_{k}}^{(n)}(\omega)}\). Suppose a shrinking split sequence \(t\) exists such that \(a_n=\sum_{k}\abs{\Delta_k^{(n)}(t)}^p\) converges. Then any other shrinking split sequence \(s\) with \(b_m=\sum_{k}\abs{\Delta_k^{(m)}(s)}^p\) will also converge and \(\lim_n a_n = \lim_m b_m\), so long as \(p\ge 1\).
       \end{lemma}

       \begin{proof}

         First, we fix any \(\epsilon>0\) and consider \(n\) large enough such that \(a_n\) is within its limit by \(\epsilon\).

         By the shrinking property of \(b_m\), for any \(\delta>0\), there exists \(M\) such that for all \(m>M\), the split \(\ca{s_k^{(m)}}\) is a \(\delta\)-cover of \([0, t]\). Let the relabeling function \(c:[n]\rightarrow[m]\) map the index \(k\) of each split point \(t_k^{(n)}\) to the closest one \(k'\) of \(s_{k'}^{(m)}\), choose \(c\) such that it is weakly increasing, which must be possible since both sequences are increasing. Then, for any \(0<\eta\le 1\), by choice of \(\delta\),
         \[
           a_n=\sum_k\abs{X_{t_{k+1}}^{(n)}-X_{t_k}^{(n)}}^p\le n\eta + \sum_k\abs{X_{s_{c(k+1)}}^{(n)}-X_{s_{c(k)}}^{(n)}}^p\le n\eta + \sum_k\sum_{j=c(k)}^{c(k+1)-1}\abs{X_{s_{j+1}}^{(n)}-X_{s_j}^{(n)}}^p\le n\eta + b_m\,\,,
         \]
         where the first inequality follows by choosing \(\delta\) small enough such that the modulus of continuity of \(X_t(\omega)\) is below \((\eta/2)^{1/p}\), the second inequality follows from triangle inequality (requiring \(p\ge 1\)), and the third adds in missing positive terms.

         Choose \(\eta\le \epsilon/n\). Thus by choice of \(M\) through \(\delta\) we have for all \(m>M\) that \(a_n-\epsilon\le b_m\).

         Since the sequence \(\{a_{n'}\}_{n'}\) is itself shrinking, we may repeat this logic above starting from any \(b_m\) to find that for any \(\epsilon'>0\), for all sufficiently large \(n'=n'(\epsilon')\), \(b_m-\epsilon'\le a_{n'}\). Taking limits we find that \(b_m\le \lim_{n'} a_{n'}\). Combining with the original property of \(n\), we have that \(b_m\) must be within \(2\epsilon\) of \(\lim_n a_n\) for all sufficiently large \(m\).

       \end{proof}

       Given the above, we need only consider some fixed shrinking split sequence to analyze variation of a stochastic process. One surely exists: just use the unique evenly spaced split sequence.

         \begin{theorem}[Quadratic Variation of Brownian Motion]
           For Brownian motion \(X_t\),
           \[[X]_t^{(2)}=t\,\,.\]
         \end{theorem}
         \begin{proof}
           Let \(\Delta_k=\Delta_k^{(n)}(t)\) for \(t_k^{(n)}\) to be the sequence with distance \(\frac{t}{n-1}\) between each point. Then we will show \(\sum_k\Delta_k\mathbin{\overset{L^2\pa{\P}}{\longrightarrow}} t\). Recall that convergence in \(L^{p}\) implies convergence in probability by Markov's inequality, and convergence in probability implies almost sure convergence of a subsequence by decreasing the probability of deviation exponentially and applying Borel-Cantelli. Then, some subsequence \(\{n_m\}_m\) yields \(\sum_k\Delta^{(n_m)}_k(t)\) which converges almost surely to both \(t\) and \([X]_t^{(2)}\), implying the latter are equal.

           It remains to show the original \(L^2(\P)\) convergence. Indeed, leveraging independent increments, and letting \(\sigma^2=\frac{t}{n-1}\),
           \begin{align*}
             \E\pa{\sum_k\Delta_k-t}^2&=\sum_k\E\Delta_k^4+\sum_k\sum_{j\neq k}\E\Delta_k^2\E\Delta_j^2-2t\sum_k\E\Delta_k^2+t^2\\
                                      &=3n\sigma^4+n(n-1)\sigma^4-2tn\sigma^2+t^2\\
             &= O\pa{\mathrm{poly}(t)n^{-1}}\,\,,
           \end{align*}
           where critically all nonvanishing \(t^2\) terms cancel.
         \end{proof}

         \begin{theorem}[Total Variation of Brownian Motion]
           For Brownian motion \(X_t\),
           \[[X]_t^{(1)}=\infty\,\,.\]
         \end{theorem}
         \begin{proof}
           It suffices to show that \([X]_t^{(1)}<\infty\) implies \([X]_t^{(2)}=0\). Then by the contrapositive the conclusion follows since Brownian motion has a positive quadratic variation.

           Indeed, for any \(\epsilon>0\) if \(n\) is sufficiently large then \(\abs{\Delta_k^{(n)}(t)}\le\epsilon\), holding across all \(k\), by uniform continuity, since \(\delta_k^{(n)}\) is sufficiently small. In turn \(\sum_k\abs{\Delta_k^{(n)}}^2\le\epsilon\sum_k\abs{\Delta_k^{(n)}}=O(\epsilon)\) since the sum is itself \(O(1)\) by assumption. Taking limits we have that the quadratic variation must be \(0\).
\end{proof}
\end{document}


\documentclass[11pt]{article}

%-----------------------------------------------------------------------------%
% Margins:
%-----------------------------------------------------------------------------%
\usepackage[margin=1in]{geometry} % to modify margins

%-----------------------------------------------------------------------------%
% Font:
%-----------------------------------------------------------------------------%

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{palatino}
\usepackage{mathpazo}
\usepackage{stmaryrd}

%-----------------------------------------------------------------------------%
% PDF:
%-----------------------------------------------------------------------------%

\usepackage{hyperref}
%\hypersetup{colorlinks=true,citecolor=blue,pdfpagemode=UseNone}

%-----------------------------------------------------------------------------%
% Various packages:
%-----------------------------------------------------------------------------%

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{amsthm}
\usepackage{sectsty}
\usepackage[usenames]{color}
\usepackage{authblk} % nice auth & affil
%-----------------------------------------------------------------------------%
% Theorem-like environments:
%-----------------------------------------------------------------------------%

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{prop}[theorem]{Proposition}
\newtheorem{cor}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{remark}[theorem]{Remark}
\newtheorem*{fact}{Fact}
\newtheorem{example}[theorem]{Example}

%-----------------------------------------------------------------------------%
% Macros:
%-----------------------------------------------------------------------------%

\newcommand{\comment}[1]{\begin{quote}\sf [*** #1 ***]\end{quote}}
\newcommand{\tinyspace}{\mspace{1mu}}
\newcommand{\microspace}{\mspace{0.5mu}}
\newcommand{\op}[1]{\operatorname{#1}}

\newcommand{\norm}[1]{\left\lVert\tinyspace#1\tinyspace\right\rVert}
\newcommand{\snorm}[1]{\lVert\tinyspace#1\tinyspace\rVert}
\newcommand{\abs}[1]{\left\lvert\tinyspace #1 \tinyspace\right\rvert}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\def\iso{\cong}
\newcommand{\defeq}{\stackrel{\smash{\text{\tiny def}}}{=}}
\newcommand{\tr}{\operatorname{Tr}}
\newcommand{\rank}{\operatorname{rank}}
\renewcommand{\det}{\operatorname{Det}}
\renewcommand{\vec}{\operatorname{vec}}
\newcommand{\im}{\operatorname{Im}}
\renewcommand{\t}{{\scriptscriptstyle\mathsf{T}}}
\newcommand{\ip}[2]{\left\langle #1 , #2\right\rangle}
\newcommand{\sip}[2]{\langle #1 , #2\rangle}
\def\({\left(}
\def\){\right)}
\def\I{\mathbb{1}}

\newcommand{\triplenorm}[1]{%
  \left|\!\microspace\left|\!\microspace\left| #1
  \right|\!\microspace\right|\!\microspace\right|}

\newcommand{\fid}{\operatorname{F}}
\newcommand{\setft}[1]{\mathrm{#1}}
\newcommand{\lin}[1]{\setft{L}\left(#1\right)}
\newcommand{\density}[1]{\setft{D}\left(#1\right)}
\newcommand{\unitary}[1]{\setft{U}\left(#1\right)}
\newcommand{\trans}[1]{\setft{T}\left(#1\right)}
\newcommand{\herm}[1]{\setft{Herm}\left(#1\right)}
\newcommand{\pos}[1]{\setft{Pos}\left(#1\right)}
\newcommand{\pd}[1]{\setft{Pd}\left(#1\right)}
\newcommand{\sphere}[1]{\mathcal{S}\!\left(#1\right)}
\newcommand{\opset}[3]{\setft{#1}_{#2}\!\left(#3\right)}

\def\complex{\mathbb{C}}
\def\real{\mathbb{R}}
\def\natural{\mathbb{N}}
\def\integer{\mathbb{Z}}

\def \lket {\left|}
\def \rket {\right\rangle}
\def \lbra {\left\langle}
\def \rbra {\right|}
\newcommand{\ket}[1]{\lket\microspace #1 \microspace\rket}
\newcommand{\bra}[1]{\lbra\microspace #1 \microspace\rbra}

\newenvironment{mylist}[1]{\begin{list}{}{
	\setlength{\leftmargin}{#1}
	\setlength{\rightmargin}{0mm}
	\setlength{\labelsep}{2mm}
	\setlength{\labelwidth}{8mm}
	\setlength{\itemsep}{0mm}}}
	{\end{list}}

\newcommand{\class}[1]{\textup{#1}}
\newcommand{\prob}[1]{\textit{#1}}
\newcommand{\reg}[1]{\mathsf{#1}}

\def\X{\mathcal{X}}
\def\Y{\mathcal{Y}}
\def\Z{\mathcal{Z}}
\def\W{\mathcal{W}}
\def\A{\mathcal{A}}
\def\B{\mathcal{B}}
\def\V{\mathcal{V}}
\def\U{\mathcal{U}}
\def\C{\mathcal{C}}
\def\D{\mathcal{D}}
\def\E{\mathcal{E}}
\def\F{\mathcal{F}}
\def\M{\mathcal{M}}
\def\R{\mathcal{R}}
\def\P{\mathcal{P}}
\def\Q{\mathcal{Q}}
\def\S{\mathcal{S}}
\def\T{\mathcal{T}}
\def\K{\mathcal{K}}
\def\yes{\text{yes}}
\def\no{\text{no}}

\begin{document}

%-----------------------------------------------------------------------------%
\title{\bf TITLE}
%-----------------------------------------------------------------------------%
\author[1]{Author 1}
\author[2]{Author 2}
\affil[1]{Portland State University \texttt{abc@abc}}
\affil[2]{University \texttt{abc@abc}}

%\date{August 3, 2009}
\date{\today}

\maketitle

\begin{abstract}   % Short summary of paper.

\end{abstract}

%-----------------------------------------------------------------------------%
\section{Introduction} \label{sec:introduction}
%-----------------------------------------------------------------------------%

%-----------------------------------------------------------------------------%
\section{Preliminaries} \label{sec:preliminaries}
%-----------------------------------------------------------------------------%

%-----------------------------------------------------------------------------%
\section{Content}
\label{sec:con}
%-----------------------------------------------------------------------------%

%-----------------------------------------------------------------------------%
\section{More content} \label{sec:more}
%-----------------------------------------------------------------------------%

\bibliographystyle{alpha}
%\bibliography{QIP-equals-PSPACE}

% \begin{thebibliography}

% \bibitem[AB09]{AroraB09}
% S.~Arora and B.~Barak.
% \newblock {\em Computational Complexity: A Modern Approach}.
% \newblock Cambridge University Press, 2009.

% \end{thebibliography}

\end{document}


\subsection{More Superpixels}
\label{subsec:experiments-k}

\begin{table}[t]
	\centering
	{\scriptsize
	\begin{tabular}{| r | l | l | l | l | l |}
		\hline
		& \Rec & \UE & \EV & \K & $t$\\\hline
		\W & 0.9998 & 0.0377 & 0.9238 & 20078.2 & 0.0090\\
		\PF & 0.9512 & 0.0763 & 0.8834 & 15171.5 & 0.0105\\
		\CIS & 0.9959 & 0.0353 & 0.9792 & 15988.6 & 7.617\\
		\SLIC & 0.9997 & 0.0339 & 0.9570 & 17029.7 & 0.1633\\
		\CRS & 0.9999 & 0.0265 & 0.9587 & 24615.8 & 4.7014\\
		\ERS & 0.9999 & 0.0297 & 0.9564 & 20000 & 0.5935\\
		\PB & 0.9988 & 0.0398 & 0.9477 & 15058.9 & 0.0531\\
		\SEEDS & 0.9997 & 0.0340 & 0.9729 & 18982.5 & 0.2267\\
		\VC & 0.9482 & 0.04621 & 0.9631 & 10487.5 & 2.3174\\
		\CCS & 0.9999 & 0.0223 & 0.9637 & 17676.9 & 0.227\\
		\CW & 0.9999 & 0.0322 & 0.9362 & 26319.8 & 0.0049\\
		\ERGC & 0.9999 & 0.0316 & 0.9744 & 21312 & 0.1217\\
		\MSS & 0.9989 & 0.0372 & 0.9171 & 25890.5 & 0.0894\\
		\preSLIC & 0.9999 & 0.0359 & 0.958 & 17088.3 & 0.021\\
		\WP & 0.9980 & 0.0411 & 0.9463 & 15502.7 & 0.6510\\
		\ETPS & 0.9999 & 0.0311 & 0.9793 & 17227 & 1.1657\\\hline
	\end{tabular}
	}
	\caption{\Rec, \UE, \EV, \K and runtime in seconds $t$ for $\K \approx 20000$
	on the \BSDS dataset including all algorithms able to generate $\K \gg 5000$ superpixels.
	The experiments demonstrate that nearly all superpixel algorithms are able to
	capture the image content without loss of information -- with $\Rec \approx 0.99$ and $\UE \approx 0.03$
	-- while reducing the number of primitives from $481 \cdot 321 = 154401$ to $\K \approx 20000$.}
	\label{table:experiments-k}
\end{table}

Up to now, we used \ARec, \AUE and \AEV to summarize experimental results for $\K \in [200,5200]$.
However, for some applications, generating $\K \gg 5200$ superpixels may be interesting.

For $\K \approx 20000$, superpixel algorithms can be used to dramatically reduce the
number of primitives for subsequent processing steps with negligible loss of information.
We consider Table \ref{table:experiments-k}
presenting \Rec, \UE, \EV, runtime in seconds $t$ and \K for $\K \approx 20,000$ on
the \BSDS dataset. We note that some algorithms were not able to generate $\K \gg 5200$
superpixels and are, therefore, excluded. Similarly, we excluded algorithms not offering
control over the number of generated superpixels. We observe that except for \VC and \PF all
algorithms achive $\Rec \geq 0.99$, $\UE \approx 0.03$, and $\EV > 0.9$. Furthermore, the runtime of
many algorithms is preserved. For example \W and \CW still run in below $10ms$ and the
runtime for \preSLIC and \SLIC increases only slightly. Obviously, the number of
generated superpixels varies more strongly for large~\K. Overall, most algorithms
are able to capture the image content nearly perfectly while reducing
 $321 \times 481 = 154401$ pixels to $\K \approx 20000$ superpixels.


\chapter{Measure spaces}
Here is an outline of where we are going next.
Our \emph{goal} over the next few chapters
is to develop the machinery to state (and in some cases prove)
the law of large numbers and the central limit theorem.
For these purposes, the scant amount of work we did in Calculus 101
is going to be awfully insufficient:
integration over $\RR$ (or even $\RR^n$) is just not going to cut it.

This chapter will develop the theory of ``measure spaces'',
which you can think of as ``spaces equipped with a notion of size''.
We will then be able to integrate over these
with the so-called Lebesgue integral
(which in some senses is almost strictly better than the Riemann one).

\section*{Letter connotations}
There are a lot of ``types'' of objects moving forward,
so here are the letter connotations we'll use
throughout the next several chapters.
This makes it easier to tell what the ``type'' of each object
is just by which letter is used.
\begin{itemize}
	\ii Measure spaces denoted by $\Omega$,
	their elements denoted by $\omega$.
	\ii Algebras and $\sigma$-algebras denoted by script $\SA$, $\SB$, \dots.
	Sets in them denoted by early capital Roman $A$, $B$, $C$, $D$, $E$, \dots.
	\ii Measures (i.e.\ functions assigning sets to reals)
	denoted usually by $\mu$ or $\rho$.
	\ii Random variables (functions sending worlds to reals)
	denoted usually by late capital Roman $X$, $Y$, $Z$, \dots.
	\ii Functions from $\RR \to \RR$
	by Roman letters like $f$ and $g$ for pdf's
	and $F$ and $G$ for cdf's.
	\ii Real numbers denoted by lower Roman letters like $x$, $y$, $z$.
\end{itemize}

\section{Motivating measure spaces via random variables}
To motivate \emph{why} we want to construct measure spaces,
I want to talk about a (real) \vocab{random variable},
which you might think of as
\begin{itemize}
	\ii the result of a coin flip,
	\ii the high temperature in Boston on Saturday,
	\ii the possibility of rain on your 18.725 date next weekend.
\end{itemize}

Why does this need a long theory to develop well?
For a simple coin flip one intuitively just thinks
``50\% heads, 50\% tails'' and is done with it.
The situation is a little trickier with temperature
since it is continuous rather than discrete,
but if all you care about is that one temperature,
calculus seems like it might be enough to deal with this.

But it gets more slippery once the variables start to ``talk to'' each other:
the high temperature tells you a little bit about whether it will rain,
because e.g.\ if the temperature is very high it's quite likely to be sunny.
Suddenly we find ourselves wishing we could talk about conditional probability,
but this a whole can of worms --- the relations
between these sorts of things can get very complicated very quickly.

The big idea to getting a formalism for this is that:
\begin{moral}
	Our measure spaces $\Omega$ will be thought of as a space of entire worlds,
	with each $\omega \in \Omega$ representing a world.
	Random variables are functions from worlds to $\RR$.
\end{moral}
This way, the space of ``worlds'' takes care of all the messy interdependence.

Then, we can assign ``measures'' to sets of worlds:
for example, to be fair coin means that if you are only interested in
that one coin flip, the ``fraction'' of worlds
which that coin showed heads should be $\half$.
This is in some ways backwards from what you were told in high-school:
officially, we start with the space of worlds,
rather than starting with the probabilities.

It will soon be clear that there is no way we can assign
a well-defined measure to every single one of the $2^\Omega$ subsets.
Fortunately, in practice, we won't need to,
and the notion of a $\sigma$-algebra will capture the idea
of ``enough measur-\emph{able} sets for us to get by''.

\begin{remark}
	[Random seeds]
	Another analogy if you do some programming:
	each $\omega \in \Omega$ is a \emph{random seed},
	and everything is determined from there.
\end{remark}

\section{Motivating measure spaces geometrically}
So, we have a set $\Omega$ of possible points
(which in the context of the previous discussion
can be thought of as the set of worlds),
and we want to assign a \emph{measure} (think volume)
to subsets of points in $\Omega$.
We will now describe some of the obstacles that we will face,
in order to motivate \emph{how} measure spaces are defined
(as the previous section only motivated \emph{why} we want such things).

If you try to do this na\"{\i}vely,
you basically immediately run into set-theoretic issues.
A good example to think about why this might happen
is if $\Omega = \RR^2$ with the measure corresponding to area.
You can define the area of a triangle as in high school,
and you can then try and define the area of a circle,
maybe by approximating it with polygons.
But what area would you assign to the subset $\QQ^2$, for example?
(It turns out ``zero'' is actually a working answer.)
Or, a unit disk is composed of infinitely many points;
each of the points better have measure zero,
but why does their union have measure $\pi$ then?
Blah blah blah.

We'll say more about this later, but
you might have already heard of the \textbf{Banach-Tarski paradox}
which essentially shows there is no good way that you can assign a
measure to every single subset of $\RR^3$
and still satisfy basic sanity checks.
There are just too many possible subsets of Euclidean space.

However, the good news is that most of these sets are not ones
that we will ever care about,
and it's enough to define measures for certain
``sufficiently nice sets''.
The adjective we will use is \emph{measurable},
and it will turn out that this will be way, way more than good enough
for any practical purposes.

We will generally use $A$, $B$, \dots for measurable sets
and denote the entire family of measurable sets by curly $\SA$.

\section{$\sigma$-algebras and measurable spaces}
Here's the machine code.
\begin{definition}
	A \vocab{measurable space} consists of a space $\Omega$ of points,
	and a \vocab{$\sigma$-algebra} $\SA$ of subsets of $\Omega$
	(the ``measurable sets'' of $\Omega$).
	The set $\SA$ is required to satisfy the following axioms:
	\begin{itemize}
		\ii $\SA$ contains $\varnothing$ and $\Omega$.
		\ii $\SA$ should be closed under complements and
		\emph{countable} unions/intersections.
		(Hint on nomenclature: $\sigma$ usually indicates
		some sort of ``countably finite'' condition.)
	\end{itemize}
\end{definition}
(Complaint: this terminology is phonetically confusing,
because it can be confused with ``measure space'' later.
The way to think about is that
``measur\emph{able} spaces have a $\sigma$-algebra, so we \emph{could}
try to put a measure on it, but we \emph{haven't}, yet.'')

Though this definition is how we actually think about it in a few select cases,
for the most part, and we will usually instantiate $\SA$ in practice
in a different way:
\begin{definition}
	Let $\Omega$ be a set, and consider some family of subsets $\SF$ of $\Omega$.
	Then the \vocab{$\sigma$-algebra generated by $\SF$}
	is the smallest $\sigma$-algebra $\SA$ which contains $\SF$.
\end{definition}
As is commonplace in math, when we see ``generated'',
this means we sort of let the definition ``take care of itself''.
So, if $\Omega = \RR$, maybe I want $\SA$ to contain all open sets.
Well, then the definition means it should contain every complements too,
so it contains all the closed sets.
Then it has to contain all the half-open intervals too, and then\dots.
Rather than try to reason out what exactly the final shape $\SA$ looks like
(which basically turns out to be impossible),
we just give up and say ``$\SA$ is all the sets you can get if you start
with the open sets and apply repeatedly union/complement operations''.
Or even more bluntly: ``start with closed sets, shake vigorously''.

I've gone on too long with no examples.
\begin{example}
	[Examples of measurable spaces]
	The first two examples actually say what $\SA$ is;
	the third example (most important) will use generation.
	\begin{enumerate}[(a)]
		\ii If $\Omega$ is any set,
		then the power set $\SA = 2^{\Omega}$ is obviously a $\sigma$-algebra.
		This will be used if $\Omega$ is countably finite,
		but it won't be very helpful if $\Omega$ is huge.
		\ii If $\Omega$ is an uncountable set,
		then we can declare $\SA$ to be all subsets of $\Omega$
		which are either countable,
		or which have countable complement.
		(You should check this satisfies the definitions.)
		This is a very ``coarse'' algebra.
		\ii If $\Omega$ is a topological space,
		the \vocab{Borel $\sigma$-algebra}
		is defined as the $\sigma$-algebra generated by all the open sets of $\Omega$.
		We denote it by $\SB(\Omega)$,
		and call the space a \vocab{Borel space}.
		As warned earlier, it is basically impossible to describe
		what it looks like,
		and instead you should think of it as saying
		``we can measure the open sets''.
	\end{enumerate}
\end{example}
\begin{ques}
	Show that the closed sets are in $\SB(\Omega)$ for
	any topological space $\Omega$.
	Show that $[0,1)$ %chktex 9
	is also in $\SB(\RR)$.
\end{ques}

\section{Measure spaces}
\begin{definition}
	Measurable spaces $(\Omega, \SA)$ are then equipped
	with a function $\mu \colon \SA \to [0, +\infty]$
	called the \vocab{measure}, which is required to satisfy
	the following axioms:
	\begin{itemize}
		\ii $\mu(\varnothing) = 0$
		\ii \textbf{Countable additivity}:
		If $A_1$, $A_2$, \dots are disjoint sets in $\SA$,
		then \[ \mu\left( \bigsqcup_n A_n \right) = \sum_n \mu(A_n). \]
	\end{itemize}
	The triple $(\Omega, \SA, \mu)$ is called a \vocab{measure space}.
	It's called a \vocab{probability space} if $\mu(\Omega) = 1$.
\end{definition}
\begin{exercise}
	[Weaker equivalent definitions]
	I chose to give axioms for $\SA$ and $\mu$
	that capture how people think of them in practice,
	which means there is some redundancy:
	for example, being closed under complements and unions
	is enough to get intersections, by de Morgan's law.
	Here are more minimal definitions,
	which are useful if you are trying to prove something satisfies them
	to reduce the amount of work you have to do:
	\begin{enumerate}[(a)]
		\ii The axioms on $\SA$ can be weakened
		to (i) $\varnothing \in \SA$ and (ii) $\SA$ is closed under
		complements and countable \emph{disjoint} unions.
		\ii The axioms on $\mu$ can be weakened to
		(i) $\mu(\varnothing) = 0$,
		(ii) $\mu(A \sqcup B) = \mu(A) + \mu(B)$, and
		(iii) for $A_1 \supseteq A_2 \supseteq \cdots$,
		we have $\mu\left( \bigcap_n A_n \right) = \lim_n \mu(A_n)$.
	\end{enumerate}
\end{exercise}

\begin{remark}
Here are some immediate remarks on these definitions.
\begin{itemize}
	\ii If $A \subseteq B$ are measurable,
	then $\mu(A) \le \mu(B)$ since $\mu(B) = \mu(A) + \mu(B-A)$.
	\ii In particular, in a probability space all measures are in $[0,1]$.
	On the other hand, for general measure spaces we'll allow $+\infty$
	as a possible measure
	(hence the choice of $[0,+\infty]$ as codomain for $\mu$).
	\ii We want to allow at least countable unions / additivity
	because with finite unions it's too hard to make progress:
	it's too hard to estimate the area of a circle
	without being able to talk about limits of countably infinitely many triangles.
	\end{itemize}
\end{remark}
We \emph{don't} want to allow uncountable unions and additivity,
because uncountable sums basically never work out.
In particular, there is a nice elementary exercise as follows:
\begin{exercise}
	[Tricky]
	Let $S$ be an uncountable set of positive real numbers.
	Show that some finite subset $T \subseteq S$ has sum greater than $10^{2019}$.
	Colloquially, ``uncountable many positive reals
	cannot have finite sum''.
\end{exercise}
So countable sums are as far as we'll let the infinite sums go.
This is the reason why we considered $\sigma$-algebras in the first place.

\begin{example}
	[Measures]
	We now discuss measures on each of the spaces
	in our previous examples.
	\begin{enumerate}[(a)]
		\ii If $\SA = 2^\Omega$ (or for that matter any $\SA$)
		we may declare $\mu(A) = |A|$ for each $A \in \SA$
		(even if $|A| = \infty$).
		This is called the \vocab{counting measure},
		simply counting the number of elements.

		This is useful if $\Omega$ is countably infinite,
		and optimal if $\Omega$ is finite (and nonempty).
		In the latter case, we will often normalize by
		$\mu(A) = \frac{|A|}{|\Omega|}$
		so that $\Omega$ becomes a probability space.

		\ii Suppose $\Omega$ was uncountable
		and we took $\SA$ to be the countable sets and their complements.
		Then
		\[
			\mu(A) = \begin{cases}
				0 & \text{$A$ is countable} \\
				1 & \text{$\Omega \setminus A$ is countable}
			\end{cases}
		\]
		is a measure. (Check this.)

		\ii Elephant in the room:
		defining a measure on $\SB(\Omega)$ is hard even for $\Omega = \RR$,
		and is done in the next chapter.
		So you will have to hold your breath.
		Right now, all you know is that by declaring my \emph{intent}
		to define a measure $\SB(\Omega)$,
		I am hoping that at least every open set will have a volume.
	\end{enumerate}
\end{example}

\section{A hint of Banach-Tarski}
I will now try to convince you that $\SB(\Omega)$
is a necessary concession,
and for general topological spaces like $\Omega = \RR^n$,
there is no hope of assigning a measure to $2^{\Omega}$.
\begin{example}
	[A geometric example of why $\SA = 2^\Omega$ is unsuitable]
	Let $\Omega$ denote the unit circle in $\RR^2$
	and $\SA = 2^\Omega$.
	We will show that any measure $\mu$ on $\Omega$
	with $\mu(\Omega) = 1$ will have undesirable properties.

	Let $\sim$ denote an equivalence relation on $\Omega$
	defined as follows: two points are equivalent
	if they differ by a rotation around the origin by a rational multiple of $\pi$.
	We may pick a representative from each equivalence class,
	letting $X$ denote the set of representatives.
	Then
	\[ \Omega = \bigsqcup_{\substack{q \in \QQ \\ 0 \le q < 2}}
		\left( X \text{ rotated by $q\pi$ radians} \right).  \]
	Since we've only rotated $X$,
	each of the rotations should have the same measure $m$.
	But $\mu(\Omega) = 1$,
	and there is no value we can assign that measure:
	if $m = 0$ we get $\mu(\Omega) = 0$
	and $m > 0$ we get $\mu(\Omega) = \infty$.
\end{example}
\begin{remark}
	[Choice]
	Experts may recognize that picking a representative
	(i.e.\ creating set $X$)
	technically requires the Axiom of Choice.
	That is why, when people talk about Banach-Tarski issues,
	the Axiom of Choice almost always gets honorable mention as well.
\end{remark}

Stay tuned to actually see a construction for $\SB(\RR^n)$
in the next chapter.

\section{Measurable functions}
In the past, when we had topological spaces,
we considered continuous functions.
The analog here is:
\begin{definition}
	Let $(X, \SA)$ and $(Y, \SB)$ be measurable spaces
	(or measure spaces).
	A function $f \colon X \to Y$ is \vocab{measurable}
	if for any measurable set $S \subseteq Y$ (i.e.\ $S \in \SB$)
	we have $f\pre(S)$ is measurable (i.e. $f\pre(S) \in \SA$).
\end{definition}

In practice, most functions you encounter will be continuous anyways,
and in that case we are fine.
\begin{proposition}
	[Continuous implies Borel measurable]
	Suppose $X$ and $Y$ are topological spaces
	and we pick the Borel measures on both.
	A function $f \colon X \to Y$
	which is continuous as a map of topological spaces
	is also measurable.
\end{proposition}
\begin{proof}
	Follows from the fact that pre-images of open sets are open,
	and the Borel measure is generated by open sets.
\end{proof}

\section{On the word ``almost'' (TO DO)}
In later chapters we will begin seeing the phrase ``almost everywhere''
and ``almost surely'' start to come up,
and it seems prudent to take the time to talk about it now.

\begin{definition}
	We say that property $P$ occurs
	\vocab{almost everywhere} or \vocab{almost surely} if the set
	\[ \left\{ \omega \in \Omega \mid \text{$P$ does not hold for $\omega$} \right\} \]
	has measure zero.
\end{definition}

For example, if we say ``$f = g$ almost everywhere''
for some functions $f$ and $g$ defined on a measure space $\Omega$,
then we mean that $f(\omega) = g(\omega)$ for all $\omega \in \Omega$
other than a measure-zero set.

There, that's the definition.
The main thing to now update your instincts on is that
\begin{moral}
	In measure theory,
	we basically only care about things up to almost-everywhere.
\end{moral}
Here are some examples:
\begin{itemize}
	\ii If $f=g$ almost everywhere,
	then measure theory will basically not tell these functions apart.
	For example, $\int_\Omega f \; d\omega = \int_\Omega g \; d\omega$
	will hold for two functions agreeing almost everywhere.
	\ii As another example,
	if we prove ``there exists a unique function $f$ such that so-and-so'',
	the uniqueness is usually going to be up to measure-zero sets.
\end{itemize}
You can think of this sort of like group isomorphism,
where two groups are considered ``basically the same'' when they are isomorphic,
except this one might take a little while to get used to.\footnote{In fact,
	some people will even define functions on measure spaces
	as \emph{equivalence classes} of maps,
	modded out by agreement outside a measure zero set.}

\section{\problemhead}
\begin{dproblem}
	Let $(\Omega, \SA, \mu)$ be a probability space.
	Show that the intersection of countably many sets of measure $1$
	also has measure $1$.
\end{dproblem}

\begin{problem}
	[On countable sigma-algebras]
	\gim
	Let $\SA$ be a $\sigma$-algebra on a set $\Omega$.
	Suppose that $\SA$ has countable cardinality.
	Prove that $|\SA|$ is finite and equals a power of $2$.
\end{problem}


\documentclass{article}
\usepackage{graphicx}
\usepackage{amsfonts}

% Helpful vector shortcuts
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\deriv}[2]{\frac{d#1}{d#2}}
\newcommand{\crossprod}[6]{\left| \begin{array}{ccc} \hat{i} & \hat{j} & \hat{k} \\ #1 & #2 & #3 \\ #4 & #5 & #6 \end{array}\right|}
\newcommand{\curlcrossprod}[3]{\crossprod{\pderiv{}{x}}{\pderiv{}{y}}{\pderiv{}{z}}{#1}{#2}{#3}}
\newcommand{\vecx}{\vec{x}}
\newcommand{\vecb}{\vec{b}}
\newcommand{\vecr}{\vec{r}}
\newcommand{\vecz}{\vec{z}}
\newcommand{\vecp}{\vec{p}}
\newcommand{\vecomega}{\vec{\omega}}
\newcommand{\laplace}{\nabla^2}
\newcommand{\curl}{\nabla\times}
\newcommand{\colvec}[3]{\left(\begin{array}{c} #1 \\ #2 \\ #3 \end{array}\right)}
\newcommand{\dotgrad}{\cdot\nabla}

% macros to typeset code
\newcommand{\pkeyword}[1]{\textbf{#1 }}
\newcommand{\pwhile}{\pkeyword{while}}
\newcommand{\pif}{\pkeyword{if}}
\newcommand{\pthen}{\pkeyword{ then}}
\newcommand{\pelse}{\pkeyword{ else}}
\newcommand{\pindent}{\textrm{\quad}}
\newcommand{\pcomment}[1]{\textrm{#1}}
\newcommand{\pfor}{\pkeyword{for}}

\title{Incomplete Cholesky Preconditioner}
\author{Andrew Selle, Ron Fedkiw}

\begin{document}
\maketitle
\section{Preconditioned Conjugate Gradient}

For more detail on PCG see \emph{Matrix Computations}, Golub and Van Loan pg. 534 (section 10.3.1).  We wish to solve $A\vecx=\vecb$. Instead we'll
solve $\tilde{A}\tilde{\vecx}=\tilde{\vecb}$ which we call our preconditioned system.  The idea is to select a $C$ that looks like $A$.  Then we
could solve $C^{-1}A\vecx=C^{-1}\vecb$. Obviously, if $C=A$ then $A^{-1}A\vecx=I\vecx=\vecx=\vecb$. Instead, so we can simplify the actual algorithm,
we choose $\tilde{A}=C^{-1}AC^{-1}$ and $\tilde{\vecx} =C\vecx$ and $\tilde{\vecb}=C^{-1}b$. We want $\tilde{A}$ to be symmetric positive definite
like $A$. Golub defines $M=C^2=A$ as a ``preconditioner'' matrix. Note that $C=$``$\sqrt{A}$'' exists because $A$ is symmetric positive definite.

The algorithm assumes that $\vecb$ is zero in the null space, which makes sense because $b$ is in the range of $Ax$. PCG can do this by simply
reprojecting  with \verb|Enforce_Compatibility|, but this is not the best way. \verb|PROJECTION| can be smarter about this in the case of fluids, for
example handling Neumann sub-regions by adjusting only elements on the boundaries. Note that $\vecx$ may have a null space component, since PCG never
uses $\vecx$ directly. It is only used to compute $\vecr=\vecb-A\vecx$ where $A$ kills that part of $\vecx$. In fact the only place where the null
space component can return is from the solve of $M\vecz=\vecr$ and that is why we explicitly reproject it after that solve.
$$\begin{array}{ll}
k=1\\
\vecr=\vecb -A\vecx  & \\
\pwhile \|\vecr\|_\infty > \varepsilon & \\
\pindent \pkeyword{solve} M\vecz=\vecr & \pcomment{$M$ is incomplete
cholesky factor $LL^T\vecz=\vecr$}\\
\pindent\pcomment{Project out null space component of $z$}&
\\
\pindent\pif k=1 \pthen \beta=0 \pelse \beta=\vecr_{k-1}\cdot\vecz_{k-1}/\vecr_{k-2}\cdot\vecz_{k-2}&\\
\pindent \vecp_k=\vecz_{k-1}+\beta_k\vecp_{k-1}&\\
\pindent \alpha_k=\vecr_{k-1}^T\vecz_{k-1}/\vecp_k^TA\vecp_k&\\
\pindent \vecx_k=\vecx_{k-1}+\alpha_k \vecp_k\\
\pindent \vecr_k=\vecr_{k-1}-\alpha_kA\vecp_k\\
\pindent k=k+1\\
\end{array}$$
\section{Incomplete Cholesky Factorization}
Besides ``looking like'' $A$, the ``preconditioner'' $M$ should also be easy to form and invert.  Cholesky factorization produces $LL^T=LU=M$ which
can be solved by two cycles of back substitution. The algorithm as in Golub and Van Loan pg. 145 define outer product version:
$$\begin{array}{ll}
\pfor k=1:n\\
\pindent A(k,k)=\sqrt{A(k,k)}\\
\pindent A(k+1:n,k)=A(k+1:n,k)/A(k,k)\\
\pindent\pfor j=k+1:n\\
\pindent\pindent A(j:n,j)=A(j:n,j)-A(j:n,k)A(j,k)\\
\end{array}$$
Incomplete cholesky only writes to an element $i,j$ if $A(i,j)$ is non-zero.  Thus the incomplete Cholesky factorization is formed by:
$$\begin{array}{ll}
\pfor k=1:n\\
\pindent A(k,k)=\sqrt{A(k,k)}\\
\pindent \pfor i=k+1:n \\
\pindent \pindent \pif A(i,k) \ne 0 \pthen A(i,k)=A(i,k)/A(k,k)\\
\pindent\pfor j=k+1:n\\
\pindent\pindent\pfor i=j:n\\
\pindent\pindent\pindent \pif A(i,j)\ne 0 \pthen
A(i,j)=A(i,j)-A(k,i) A(j,k)\\
\end{array}$$
After the $k$th iteration of the matrix we get a $L_0L_0^T$ block like
%$$\choleskyblock{\sqrt{A(1,1)}}{}{}{}$$
$$M=L_0L_0^T=\left(\begin{array}{c|c}
\sqrt{a(k,k)} & 0 \\
\hline \begin{array}{c} \frac{a_{k+1,k}}{\sqrt{a_{k,k}}} \\ \frac{a_{k+2,k}}{\sqrt{a_{k,k}}} \\
\vdots
\\ \frac{a_{n,k}}{\sqrt{a_{k,k}}}
\end{array} & A_{k+1,k+1}-\frac{col_k col_k^T}{a_{k,k}}
 \\
\end{array}\right)
\left(\begin{array}{c|c}
\sqrt{a(k,k)} & \begin{array}{cccc} \frac{a_{k,k+1}}{\sqrt{a_{k,k}}} &\frac{a_{k,k+2}}{\sqrt{a_{k,k}}} & \cdots &  \frac{a_{k,n}}{\sqrt{a_{k,k}}}\end{array} \\
\hline 0 & A_{k+1,k+1}-\frac{col_k col_k^T}{a_{k,k}}
 \\
\end{array}\right)$$
But we would rather not compute the square root because it is expensive.  So instead of $L_0L_0^T$ for our preconditioner we will refactor it to be
$LU$ where $L=\frac{1}{\sqrt{a_{k,k}}}L_0$ and $U=\sqrt{a_{k,k}}L_0$ so we get:
$$M=LU=\left(\begin{array}{c|c}
1 & 0 \\
\hline \begin{array}{c} \frac{a_{k+1,k}}{{a_{k,k}}} \\ \frac{a_{k+2,k}}{{a_{k,k}}} \\
\vdots
\\ \frac{a_{n,k}}{{a_{k,k}}}
\end{array} & A_{k+1,k+1}-\frac{col_k col_k^T}{a_{k,k}}
 \\
\end{array}\right)
\left(\begin{array}{c|c}
{a(k,k)} & \begin{array}{cccc} a_{k,k+1} &a_{k,k+2} & \cdots &  a_{k,n}\end{array} \\
\hline 0 & A_{k+1,k+1}-\frac{col_k col_k^T}{a_{k,k}}
 \\
\end{array}\right)$$
\subsection{Uniform Grid}

For the case of the uniform grid this new factorization can be made fast. In particular, we know that we will not update for any part of the matrix
that is not in the block $A(k:n,k:n)$. In particular, the coupling associated with the bottom and with the left are not in the block. That implies
that the column and row used in the outer product will consist of only two nonzero entries, the right and the top. Thus, the only place where the
outer product can be non-zero is at these positions (the crossings in the figure). But, the crossings on the off-diagonals are zero entries in the
original matrix because right and top are decoupled so they will not be filled.  This is not true in the general case (like for an octree grid), but
in the uniform grid case it allows us to update only the diagonals. Alternatively, we can think of the reverse and consider which elements can modify
a given diagonal.  In that case only the left and bottom will modify a given cell's diagonal entry.

\includegraphics[width=4in]{uniform}

We can represent both $L$ and $U$ in one $n\times n$ matrix because $L$'s diagonal is all ones. For efficiency we actually represent the diagonal of
the Cholesky factorization as the reciprocal.  Note $C_\textrm{r}$, $C_\textrm{c}$, $C_\textrm{t}$ are the right, center, and top values for a given
matrix row for the cell $i,j$. The code to form the $LU$ matrices for 2d becomes:
$$\begin{array}{ll}
C=A\\
\pfor k=1:n\\
\pindent i,j\in\mathbb{Z^+} \textrm{ \quad s.t. } k=i+jN\\
\pindent 1/[C_\textrm{c}(i,j)=A(k,k)-C_\textrm{r}(i-1,j)^2 C_\textrm{c}(i-1,j) -C_\textrm{t}(i,j-1)^2C_\textrm{c}(i,j-1)]\\
\end{array}$$

When doing the backsubstitution solves during the $Mz=b$ step of PCG, we see that having the reciprocal diagonal allows us to multiply instead of
divide by the diagonal element during a row solve.

\subsection{Sparse Matrix}

In a general sparse matrix we cannot make the simplifying assumption of only modifying the diagonal.  Moreover the representation of the sparsity
biases certain accesses to be computationally cheaper.  Our implementation keeps each row of the matrix in a sparse vector which keeps an array of
indices and values. Thus, traversing the columns of a single row is very cheap.  Traversing down a column is expensive. Thus, we reorder the Cholesky
formation process to only go through each row once.

\subsection{Modified Cholesky}

Incomplete Cholesky is known to perform poorly as the grid is refined.  To solve this problem, the modified Cholesky scheme is employed, where the
elements of the outer product that are not filled in (due to the sparsity pattern of $A$) are added to diagonal of that row instead - usually
diminished by a factor of about $.95$.

$$\begin{array}{ll}
\pfor k=1:n\\
\pindent A(k,k)=\sqrt{A(k,k)}\\
\pindent \pfor i=k+1:n \\
\pindent \pindent \pif A(i,k) \ne 0 \pthen A(i,k)=A(i,k)/A(k,k)\\
\pindent\pfor j=k+1:n\\
\pindent\pindent\pfor i=j:n\\
\pindent\pindent\pindent\,\, \pif\ A(i,j)\ne 0 \pthen
A(i,j)=A(i,j)-A(k,i) A(j,k)\\
\pindent\pindent\pindent\pelse\ A(i,i)=A(i,i)-A(k,i)A(j,k)\\
\end{array}$$
More detail can be found in Chan and Van Der Vorst \emph{Approximate and Incomplete Factorizations}.

\end{document}


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{blindtext}
\usepackage{amssymb}

\usepackage{amsthm}
\usepackage{mathtools}

\usepackage{graphicx}
\usepackage{subcaption}

%\newtheorem{theorem}{Theorem}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}

\theoremstyle{remark}
\newtheorem*{remark}{Remark}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\title{Complexity Results for MPE in SPNs}
\author{Jun MEI}
% \date{May 2014}

\graphicspath{ {images/} }

% \renewcommand\qedsymbol{$\blacksquare$}

\begin{document}

\maketitle

\section{Approximating MPE is hard}
In complexity theory, the class $APX$ is the set of $NP$ optimization problems that allow polynomial-time approximation algorithms with approximation ratio bounded by a constant. We show that the MPE problem in SPNs is not in $APX$ unless $P=NP$.

The Maximum Independent Set (MAX-IS) problem is not in $APX$ unless $P=NP$. Without loss of generality, we assume the graph of MAX-IS has no isolated vertex in the following discussion. We construct an auxiliary SPN to show that if MPE is in $APX$, then MAX-IS is also in $APX$.

\theoremstyle{definition}
\begin{definition}[Auxiliary SPN]
\label{thm:auxspn}
Let graph $G(V, E)$ be an arbitrary instance of MAX-IS. The \textit{auxiliary SPN} $S$ corresponding to $G$ is constructed as follows.
\begin{enumerate}
    \item The root of $S$ is a sum node $s$.
    \item $\forall v_i \in V$, there is a product node $p_i$ linked by $s$.
    \item $\forall (v_i, v_j) \in E$, there is a Boolean variable $X_{i,j}$, with $x_{i,j}$ denoting $true$ linked by $p_i$ and $\overline x_{i,j}$ denoting $false$ linked by $p_j$.
    \item $\forall X_{i, j}, \forall p_k$, if $X_{i, j} \notin scope(p_k)$, we link $p_k$ to $s_{i, j}$ where $s_{i, j}$ is a sum node linking to $x_{i, j}$ and $\overline x_{i, j}$.
\end{enumerate}
The weight of every edge from sum nodes is $1$.
\end{definition}
\begin{figure}[ht]

\begin{subfigure}{0.33\textwidth}
\includegraphics[width=0.9\linewidth]{is}
\caption{Graph $G$}
\label{fig:is}
\end{subfigure}
\begin{subfigure}{0.66\textwidth}
\includegraphics[width=0.9\linewidth]{auxspn}
\caption{Auxiliary SPN $S$}
\label{fig:auxspn}
\end{subfigure}

\caption{An instance of MAX-IS and the corresponding auxiliary SPN}
\label{fig:isauxspn}
\end{figure}

Figure \ref{fig:isauxspn} shows an example of the definition \ref{thm:auxspn}.

\begin{lemma}
Let graph $G(V, E)$ be an arbitrary instance of MAX-IS and let $S$ be the corresponding auxiliary SPN.
\begin{enumerate}
    \item Given any independent set of size $k$ in $G$, we can find an $x \in val(X)$ such that $S(x) \geq k$.
    \item Given any $x \in val(X)$ for which $S(x) = k$, we can find an  independent set of size $k$ in $G$.
\end{enumerate}
\end{lemma}
\begin{proof}
\textbf{Part 1:} Let $V'$ be the given independent set. $\forall (v_i, v_j) \in E$, let
\[
X_{i, j} =
  \begin{cases}
    true, & \text{if $v_i \in V'$,}\\
    false, & \text{if $v_j \in V'$,}\\
    \text{arbitrary value}, & \text{otherwise.}
  \end{cases}
\]
It is impossible that both $v_i, v_j \in V'$, since $(v_i, v_j) \in E$ and $V'$ is an independent set. Thus $\forall v_i \in V', p_i(x) = 1$ where $x$ is the corresponding assignment of $X$. Thus $S(x) \geq \left|V'\right| = k$.

\textbf{Part 2:} Let $x$ be the given assignment of $X$. Since $p_i(x)$ is either 0 or 1 and $\sum{p_i(x)}=k$, there are k product nodes $p_i(x) = 1$. We construct an independent set $V'=\{v_i \in V | p_i(x)=1\}$. So, $\left|V'\right| = k$. We show that $V'$ is an independent set. $\forall v_i, v_j \in V'$, if $(v_i, v_j) \in E$, there exists a variable $X_{i,j}$ with $x_{i,j}$ linked by $p_i$ and $\overline x_{i,j}$ linked by $p_j$. That means $p_i(x)$ and $p_j(x)$ cannot both be 1. This is conflict with $p_i(x)=1$ and $p_j(x)=1$. Therefore, $V'$ is an independent set with size k.
\end{proof}

\begin{corollary}
Let $G$ be an arbitrary instance of MAX-IS and let $S$ be the MPE instance of the corresponding auxiliary SPN. Let $k^\ast$ and $k'^\ast$ be the optimal solution of $G$ and $S$. Then, $k^\ast = k'^\ast$.
\end{corollary}

\begin{lemma}
If there is an approximation algorithm for MPE with a constant ratio $\rho$ in polynomial time, then there is an approximation algorithm for MAX-IS with the same constant ratio $\rho$ in polynomial time.
\end{lemma}

\begin{proof}
Let $G$ be an arbitrary instance of MAX-IS and let $S$ be the MPE instance of the corresponding auxiliary SPN. Let $k^\ast$ be the optimal solution of $S$. Suppose we can approximate $S$ with a bound $\rho=k/k^\ast$, i.e., we can find a solution $k=\rho \times k^\ast$ for $S$. Furthermore, we can find a solution $k' = k$ for $G$. The approximation ratio of $G$ is $\rho'=k'/k^\ast = k/k^\ast = \rho$. Finally, all the above works are in polynomial time.
\end{proof}

\begin{corollary}
If MPE is in $APX$, then MAX-IS is also in APX.
\end{corollary}

\begin{theorem}
MPE is not in $APX$ unless $P=NP$.
\end{theorem}
\begin{proof}
Suppose $P \neq NP$. Suppose MPE is in $APX$. Thus MAX-IS is in $APX$. This is conflict with the fact MAX-IS is not in $APX$ if $P \neq NP$.
\end{proof}
\end{document}


\vspace{-0\baselineskip}
\section{Preliminaries}
\label{sec:preliminaries}
\vspace{-0\baselineskip}

\begin{figure*}[!htp]
\centering
\includegraphics[width=\textwidth]{figures/pipeline_comp.pdf}
\caption{Framework of our approach.}
\label{fig:pipeline}
\vspace{-.3\baselineskip}
\end{figure*}

In order to make the paper self-contained, we first introduce several preliminaries proposed in the unsupervised learning pipelines \cite{zhou2017unsupervised,godard2016unsupervised}. The core idea behind, as discussed in Sec. \ref{sec:related}, is inverse warping from target view to source view with awareness of 3D geometry, as illustrated in Fig. \ref{fig:3d_warping}(a), which we will elaborate in the following paragraphs.

\begin{figure}[!htp]
\centering
\includegraphics[width=0.5\textwidth]{figures/3d_warping_comp.pdf}
\caption{Illustraion of (a) 3D inverse warping and (b) bilinear interpolation.}
\label{fig:3d_warping}
\vspace{-1.1\baselineskip}
\end{figure}

\textbf{Perspective projection between multiple views.}
Let $D(x_t)$ be the depth value of the target view at image coordinate $x_t$, and $\ve{K}$ be the intrinsic parameter of the camera. Suppose the relative pose from the target view to source view is a rigid transformation $\ve{T}_{t\rightarrow s} = [\ve{R} | \ve{t}] \in \hua{S}\hua{E}(3)$, and $h(x)$ is the homogeneous coordinate given $x$. The perspective warping to localize corresponding pixels can be formulated as,
\begin{align}
\label{eqn:warp}
D(x_s)h(x_s) = \ve{K}\ve{T}_{t\rightarrow s}D(x_t)\ve{K}^{-1}h(x_t),
\end{align}
and the image coordinate $x_s$ can be obtained by dehomogenisation of $D(x_s)h(x_s)$. Thus, $x_s$ and $x_t$ is a pair of matching coordinates, and we are able to compare the similarity between the two to validate the correctness of structure.

\textbf{Photometric error from view synthesis.}
\label{chap:warping}
%that the color of each pixel is necessarily be similar after perspective projection for a static rigid scene
Given pixel matching pairs between target and source views, \ie $I_t$ and $I_s$, we can synthesis a target view $\hat{I_s}$ from the given source view through bilinear interpolation~\cite{GargBR16}, as illustrated in Fig. \ref{fig:3d_warping}(b).
Then, under the assumption of Lambertian and a static rigid scene, the average photometric error is often used to recover the depth map $D$ for the target view and the relative pose.
However, as pointed out by \cite{zhou2017unsupervised}, this assumption is not always true, due to the fact of moving objects and occlusion. An explainability mask $\ve{M}$ is induced to compensate for this. Formally, the masked photometric error is,
\begin{align}
\label{eqn:photometric}
& \scr{L}_{vs}(D, \hua{T}, \hua{M}) = \sum_{s=1}^{S}\sum_{x_t}\ve{M}_s(x_t)|I_t(x_t) - \hat{I_s}(x_t)|, \nonumber \\
& \text{s.t. ~} \any x_t, s\text{~~} \ve{M}_s(x_t)\in [0, 1],\text{~} D(x_t) > 0
\end{align}
where $\{\hat{I_s}\}_{s=1}^{S}$ is the set of warped source views, and $\hua{T}$ is a set of transformation from target view to each of the source views.
$\hua{M} = \{\ve{M}_s\}$ is a set of explainability masks, and $\ve{M}_s(x_t) \in [0, 1]$ weights the error at $x_t$ from source view $s$.

%One main supervision of our framework comes from novel view synthesis: given an input view of a scene and camera motion, synthesize an image of the scene seen from a different view.
% We can synthesize an image of the target view given the image of source view, camera motion from target view to source view and depth map of target view, using 3D inverse warping. The process of warping is shown in Figure \ref{fig:3d_warping}.
% Each pixel (point on the grid) of depth map is first mapped onto 3D space. The 3D point cloud is transformed based on camera motion and then mapped back to 2D plane. Each grid point in target view corresponds to one point in source view. Similar to \cite{jaderberg2015spatial}, the bilinear interpolation is implemented to calculate each pixel value of warped image as a weighted sum of four nearest neighboring pixels in source image, weighted by the square area between the projected point and neighboring point, as shown in Figure \ref{fig:3d_warping} (b).

% The warping loss is a photometric difference between the target image and warped image. $$$$
% In which, $s$ iterates the number of source image, $p$ iterates each pixel in the image, $I_t$ is the target image, $I_s$ is the source image, $\hat{I_s} = \tau(I_s, D_t, Rt)$ is the warped image, $\tau$ is the warping function as introduced above.

\textbf{Regularization.}
As mentioned in \secref{sec:intro}, supervision based solely on photometric error is ambiguous. One pixel could match to multiple candidates, especially in low-texture regions. In addition, there is trivial solution for explainability mask by setting all values to zero. Thus, to reduce depth ambiguity and encourage non-zero masks, two regularization terms are applied,
% One issue with using only view synthesis as supervision is that the back-propagation gradients are solely derived from the pixel value difference between one point in target image and weighted sum of its four neighboring points in source image. The warping loss will not be useful for learning where the point falls on low-texture regions. The predicted depth on these regions can be of any value as long as the warped region has the similar pixel value.  To overcome this issue, a prior knowledge of the scene geometry is incorporated for a smoothness loss:

\begin{align}
\label{eqn:regular}
\scr{L}_{s}(D, 2) &= \sum_{x_t}\sum_{d \in {x, y}}|\nabla^{2}_dD(x_t)|e^{-\alpha|\nabla_dI(x_t)|} & \nonumber \\
\scr{L}_{m}(\hua{M}) &= -\sum_s\sum_{x_t}\log P(\ve{M_s}(x_t) = 1) &
\end{align}
$\scr{L}_{s}(D, 2)$ is a spatial smoothness term penalizes L1 norm of second-order gradients of depth along both x and y directions, encouraging depth values to align in planar surface when no image gradient appears. Here, the number $2$ represents the 2nd order for depth. $\scr{L}_{m}(\hua{M})$ is cross-entropy between the masks and maps with value 1.

 % As depth discontinuity often happens at image gradients, the smoothness loss is weighted by the a function of image gradients to prevent smoothed depth at image gradients.

Finally, a multi-scale strategy is applied to the depth output, and the total loss for depth estimation from videos is a joint functional from previous terms,
\begin{align}
\label{eqn:full}
\scr{L}_{o}(\{D_l\}, \hua{T}, \hua{M}) =& \sum_l\{\scr{L}_{vs}(D_l,\hua{T},\hua{M}) + \lambda_s\scr{L}_{s}(D_l) \nonumber\\
&\text{~~~~~} + \lambda_m\scr{L}_{m}(\hua{M}_l)\}
\end{align}

Given the objective functional, the photometric error can be back-propagated to depth, pose and mask networks by applying the spatial transform operation as proposed by~\cite{jaderberg2015spatial}, which supervises the learning process.