[definition: Upper and Lower Sums]
Let $a,b \in \mathbb{R}$ with $a < b$. Let $\mathcal{B}([a,b])$ be the set of bounded functions $f: [a,b] \to \mathbb{R}$, and let $\mathcal{P}([a,b])$ be the set of partitions of $[a,b]$. The upper-sum functional and lower-sum functional are maps
\begin{align*}
U,L: \mathcal{P}([a,b]) \times \mathcal{B}([a,b]) &\to \mathbb{R}.
\end{align*}
For $f \in \mathcal{B}([a,b])$ and $P=(x_0,x_1,\ldots,x_n) \in \mathcal{P}([a,b])$, define $U(P,f)$ and $L(P,f)$ as follows. For each $i \in \{1,\ldots,n\}$, set
\begin{align*}
M_i(f,P) = \sup\{f(x):x \in [x_{i-1},x_i]\}.
\end{align*}
Set
\begin{align*}
m_i(f,P) = \inf\{f(x):x \in [x_{i-1},x_i]\}.
\end{align*}
The upper sum of $f$ with respect to $P$ is
\begin{align*}
U(P,f) = \sum_{i=1}^n M_i(f,P)(x_i-x_{i-1}).
\end{align*}
The lower sum of $f$ with respect to $P$ is
\begin{align*}
L(P,f) = \sum_{i=1}^n m_i(f,P)(x_i-x_{i-1}).
\end{align*}
[/definition]