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

\subsection{Notation}
% Either a table or written out sections.
Let $\R^n$ be an $n$-dimensional real Euclidean space, and $\R[x]$ be the set of polynomials in $x$ with real-valued coefficients. For a space $X \subseteq \R^n$, the sets $C(X)$ and $C_+(X)$ are respectively the set of continuous functions on $X$ and its nonnegative subcone. The subcone $C^1(X) \subset C(X)$ is composed of continuous functions with continuous first derivatives. $\Mp{X}$ is the set of nonnegative Borel measures over $X$, and a duality pairing exists $\inp{f}{\mu} = \int_X f(x) d \mu(x)$ for all $f \in C(X), \ \mu \in \Mp{X}$. For every linear operator $\Lie$, there exists a unique linear adjoint $\Lie^\dagger$ such that $\inp{\Lie f}{\mu} = \inp{f}{\Lie^\dagger \mu}, \ \forall f,\mu$ is satisfied. An indicator function is $I_A(x)=1$ for a subset $A \subseteq X$ if $x \in A$ and $I_A(x) = 0$ otherwise. The measure of a set $A$ with respect to $\mu$ is $\mu(A) = \int_X I_A(x) d\mu$. The quantity $\mu(X) = \inp{1}{\mu}$ is known as the `mass', and $\mu$ is a probability measure if $\mu(X) = 1$. The Dirac delta $\delta_x \in \Mp{X}$ is a probability measure supported only on $x$. For measures $\mu \in \Mp{X}, \ \nu \in \Mp{Y}$, the product measure satisfies $(\mu \otimes \nu)(A \times B) = \mu(A)\nu(B)$ for all $A \in X, \ B \in Y$. The projection map $\pi^x: X \times Y \rightarrow X$ returns only the $x$ coordinate $(x, y) \rightarrow x$. The pushforward operator $\#$ on measures satisfies $\inp{v(x)}{f_\# \mu} = \inp{v(f(x))}{\mu}$ for any test function $v \in C(X)$ and function $f$. 

% This may be coupled with the projection operator: $\inp{v(\pi^x (x,y))}{\mu} = \inp{v(x)}{\mu}$ 


% The projection $\pi_{x} \eta$ of a measure $\eta \in \Mp{X \times Y}$ satisfies $\pi_x \eta(A \times B) = \eta(A)$

% Define $\R^n, \ \R[x], \ \R[x]_{\leq d}, \ C(X), \ C_+(X), \ \Mp{X}$, $\inp{f}{\mu} = \int_X{f d \mu}, \ \mu(X), \mu_1 \otimes \mu_2, \pi_t \mu$
% \urg{Fill this out}

% \subsection{Uncertainty Models}

% Dynamics are $\dot{x} = f(t, x, w)$. Uncertainty $w$ is in a set $W \subset \R^{N_w}$ for all time $t$. In numerical computation, $W$ must be compact.

% Time-independent uncertainty: $\partial_t w = 0$ and $w$ are constant throughout trajectories.

% Time-varying uncertainty: $w$ can change arbitrarily in time in the valid region $W$. No assumptions of continuity. Specific applications may add additional constraints on moments of the noise process $w$, such as $\norm{w}_2^2 = \int_{0}^T \norm{w(t)}^2_2 d t \leq 1$.

% Affine uncertainty: A specific form of time-varying dynamics which are $\dot{x} = f(t,x) + g(t,x) w$. This affine structure may make computation easier. Specific forms include polytopic (switching) uncertainty with $w \geq 0$ and $\sum_i w = 1$, and box uncertainty where $w_i \in [0, \bar{w}_i]$.

\subsection{Occupation Measures}

% Review occupation measures (initial, occupation). Include marginalization over $w$

% An occupation measure 


A trajectory of the dynamical system $\dot{x}=f(t,x)$ starting at an initial condition $x_0 \in X_0$ may be represented as $x(t \mid x_0)$ for times $t \in [0, T]$. Let $\mu_0 \in \Mp{X_0}$ be a measure distributed over initial conditions. The average occupation measure with respect to $\mu_0$ returns the expected amount of time that trajectories spend in a particular time-space region $A \subseteq [0, T], \ B  \subseteq X$ \cite{lewis1980relaxation},

\begin{equation}
    \label{eq:occ_measure}
    \mu(A \times B) = \int_{[0, T] \times X_0} I_{A \times B}((t, x(t \mid x_0)) d \mu_0(x_0) dt.
\end{equation}

The measure $\mu$ satisfies $\mu([0, T] \times X) = T$. The terminal measure $\mu^T$ that follows trajectories until time $T$ is:

\begin{equation}
    \label{eq:occ_terminal}
    \mu^T(B) = \int_{X_0} I_{B}((x(T \mid x_0)) d \mu_0(x_0).
\end{equation}

% Assuming that trajectories spend all time $[0, T]$ in $X$, then $\mu([0, T] \times X) = T$.

% \urg{Is a terminal measure necessary? We can go straight to the peak with liouville}. 
For a test function $v(t, x) \in C^1([0, T], \times X)$, the Lie derivative of $v$ with respect to the vector field $f$ is:
\begin{equation}
    \label{eq:lie_deriavite}
    \Lie_f v(t,x) = \partial_t v(t, x)+ \nabla_x v(t,x)^T f(t, x).
\end{equation}
The three measures $\mu_0, \mu, \mu_T$ are related by Liouville's equation for all test functions $v(t, x) \in C^1([0, T], \times X)$:
\begin{align}
\inp{v(T, x)}{\mu_T} &= \inp{v(0, x)}{\mu_0} + \inp{\Lie_f v(t,x)}{\mu} \label{eq:liou_int}
\end{align}
Equation \eqref{eq:liou_int} may be equivalently expressed in a weak sense by,
\begin{align}
\delta_T \otimes \mu_T &= \delta_0 \otimes \mu_0 + \Lie_f^\dagger \mu \label{eq:liou_mom}
\end{align}
Equation \eqref{eq:liou_mom} is an equivalent statement for Liouville's equation where the adjoint $\inp{\Lie_f v}{\mu} = \inp{v}{\Lie^\dagger_f \mu}$. Moments of $\mu$  can be computed by evaluating $\inp{v(t,x)}{\mu}$ where the test function $v$ is a monomial.  Equation \eqref{eq:liou_mom} is an infinite set of linear constraints in terms of moments of $\mu_0, \mu, \mu_T$.

External controls or disturbances can be added into an occupation measure framework. For an input $d(t) \in \Delta$ and a subset $D \subseteq \Delta$, the disturbance-occupation measure $\mu^d$ is:
\begin{align}
    \label{eq:occ_measure_d}
    &\mu^d(A \times B \times D) = \\
    &\quad \int_{[0, T] \times X_0} I_{A \times B \times D}((t, x(t), d(t)) \mid x_0) d \mu_0(x_0) dt. \nonumber
\end{align}
The disturbance $d(t)$ may be relaxed into a distribution $\xi(d \mid x, t)$ known as a Young Measure \cite{young1942generalized, lewis1980relaxation}.
The Liouville Equation with a relaxed disturbance $\xi$ is,
\begin{equation}
\label{eq:liou_d}
\inp{v(T, x)}{\mu_T} = \inp{v(0, x)}{\mu_0} + \inp{\Lie_f v(t, x)}{\mu^d}
\end{equation}.
% \begin{equation}
% \label{eq:liou_d}
% \delta_T \otimes \mu_T = \delta_0 \otimes \mu_0 + \pi^{tx}_\#\Lie_f^\dagger \mu^d
% \end{equation}
% The projection operator $\pi^{tx}_\#$ marginalizes the input $d(t)$ from the distribution $\xi$ of possible disturbances. 
% The measure $\mu^d$ is known  as a Young Measure, and acts as a relaxed disturbance or control  \urg{is this correct?}.

% There exists a $\mu^d$ which solves Equation \eqref{eq:liou_int} such that the support of $\mu^d$ is contained on the graph $(t, x(t), d(t))$ \cite{lasserre2008nonlinear}.

% control-occupation measure $\mu^w$ is supported on the graph

% by introducing a measure $\mu^w$:



% Write about the control-occupation measure.

\subsection{Peak Estimation}
\label{sec:peak}
% The peak estimation problem aims to solve:
% The peak estimation problem in \cite{miller2020peak} solves \eqref{eq:peak_traj} without the presence of a disturbance $w$.

Peak estimation programs may be upper bounded as infinite-dimensional linear programs (LPs) in occupation measures. These infinite dimensional programs have been approximated by discretizing the state space into finite-dimensional LPs \cite{cho2002linear}, or by using the Moment-SOS hierarchy with a set of LMIs in combinatorially increasing size \cite{fantuzzi2020bounding}. 



% It is assumed that the state sets $X$ and $X_0$ are compact basic semialgebraic sets \cite{lasserre2009moments} to assure convergence in increasing degree of the Moment-SOS hierarchy to an accumulation point.

The measure program for peak estimation from \cite{cho2002linear} is,

\begin{subequations}
\label{eq:peak_meas}
\begin{align}
p^* = & \ \textrm{max} \quad \inp{p(x)}{\mu_p} \label{eq:peak_meas_obj} \\
    & \mu_p = \delta_0 \otimes\mu_0 + \Lie_f^\dagger \mu \label{eq:peak_meas_flow}\\
    & \mu_0(X) = 1 \label{eq:peak_meas_prob}\\
    & \mu, \mu_p \in \Mp{[0, T] \times X} \label{eq:peak_meas_peak}\\
    & \mu_0 \in \Mp{X_0}. \label{eq:peak_meas_init}
\end{align}
\end{subequations}
The peak probability measure $\mu_p$ is a free-time terminal measure with a similar form to \eqref{eq:occ_terminal}, where the time-stopping can occur anywhere between $t \in [0, T]$ in order to extremize $p(x)$.
The occupation measure $\mu$ connects $\mu_0$ and $\mu_p$ by Liouville's equation \eqref{eq:peak_meas_flow}, and one consequence is that $\inp{1}{\mu} = \inp{t}{\mu_p}$. 
The dual problem to the measure program \eqref{eq:peak_meas} is posed over continuous functions, 
\begin{subequations}
\label{eq:peak_cont}
\begin{align}
    d^* = & \ \min_{\gamma \in \R} \quad \gamma & \\
    & {\gamma} \geq {v(0, x)}  &  \forall x \in X_0 \label{eq:peak_cont_init}\\
    & \Lie_f v(t, x) \leq 0 & \forall (t, x) \in [0, T] \times X \label{eq:peak_cont_f}\\
    & v(t, x) \geq p(x) & \forall (t, x) \in [0, T] \times X \label{eq:peak_cont_p} \\
    &v \in C^1([0, T]\times X) \label{eq:peak_cont_v}&
\end{align}
\end{subequations}

% $v(t,x)$ is referred to as an auxiliary function in \cite{fantuzzi2020bounding}, and is an upper bound on the cost function $p(x)$ by \eqref{eq:peak_cont_p}. 

For computational purposes, it is assumed that the set $[0, T] \times X$ is compact. This compactness asssures that programs \eqref{eq:peak_meas} and \eqref{eq:peak_cont} satisfy strong duality, since all measures have bounded moments and the image of the affine map in \eqref{eq:peak_meas_flow}-\eqref{eq:peak_meas_init} is closed and bounded (Theorem C.20 of \cite{lasserre2009moments}). These programs form an upper bound $p^* = d^* \geq P^*$ on \eqref{eq:peak_traj} without $(w, d)$. This upper bound will be tight with $p^*=d^*=P^*$ if the auxiliary function $v(t, x)$ in \eqref{eq:peak_cont_v} is allowed to be discontinuous \cite{fantuzzi2020bounding}. 
% $v(t,x)$ is an upper bound on the on the cost function $p(x)$ by \eqref{eq:peak_cont_p} for all time $t \in [0, T]$, and 
The sublevel set $\{(t,x) \mid v(t,x) \leq \gamma\}$ is an invariant set containing the graph of all trajectories starting from $X_0$ in time $[0, T]$.

% \urg{Talk about moment relaxations? SOS, polynomials?}

Problems \eqref{eq:peak_meas} and \eqref{eq:peak_cont} are a pair of infinite-dimensional linear programs. The work in \cite{cho2002linear} approximates these problems by a discretized linear program over a fine mesh. \cite{fantuzzi2020bounding} bounds \eqref{eq:peak_cont} with a sum-of-squares (SOS) relaxation of polynomial nonnegativity constraints. The SOS relaxation produces a converging sequence of upper bounds to $d^*$ when $[0, T] \times X$ is compact. This SOS formulation is dual to LMIs in moments of occupation measures formed by a finite truncation of \eqref{eq:peak_meas} \cite{lasserre2009moments}, where the size of the PSD matrix variables rises combinatorially with degree. 
% SOS and LMI relaxations produce Semidefinte Programs where the size of the PSD matrix variables rise combinatorially with degree. 
The degree-$\delta$ moment matrix for $\mu_p$ defined over the $1+N_x $ variables $(t, x)$ is a symmetric PSD matrix of size $\binom{1+N_x+\delta}{\delta}$. The sequence of optima 
Optimal trajectories extremizing $p(x)$ may be approximately recovered from LMI solutions if the moment matrices obey rank conditions \cite{miller2020recovery}.

% \urg{If space permits, put in more content about LMIs and write the LMI for the unified uncertain peak problem.}

% A degree-$\delta$ LMI relaxation of \eqref{eq:peak_meas} or SOS relaxation of \eqref{eq:peak_cont} generically results in  

% In an LMI relaxation, the coefficients of the degree-$2d$ polynomial $v(t,x)$ can be recovered from dual variables of the truncated degree-$d$ Moment program.


% \subsection{Peak Estimation}

%  Summarize peak estimation paper formulation