> [!definition]
>
> Let $\seq{x_n} \subset \real$ be a [[Sequence|sequence]] of numbers. A **upcrossing** of $[a, b] \subset \real$ is an interval $[j, k]$ such that $x_j \le a$, $x_{i} \le b$ for all $i \in (a, b)$, and $x_{k} > b$.
> [!theorem]
>
> A sequence of numbers diverge to infinity/negative infinity if and only if for any interval $[a, b]$, the number of **up-crossings** of $[a, b]$, denoted as $U[a, b]$ is finite.
>
> Given a fixed interval $[a, b]$, a sequence is eventually above/below it if and only if the number of up/down-crossings of $[a, b]$ is finite.
> [!theorem]
>
> Let $(\Omega, \cf, \bracs{\cf_n}_{n \ge 0}, \bp)$ be a [[Filtration|filtered]] [[Probability|probability space]], and $\bracs{X_n}_{n \ge 0}$ be an $\bracs{\cf_n}_{n \ge 0}$-[[Martingale|supermartingale]]. Fix $[a, b] \subset \real$, and let $U[a, b]$ be the number of up-crossings of $[a, b]$, then
> $
> \begin{align*}
> \ev(U[a, b]) &\le \frac{1}{b - a}\sup_{k \ge 0}\ev\braks{(X_k - a)^-} \\
> &\le \frac{1}{b - a}\sup_{k \ge 0}\braks{\ev(X_k^-) + a}
> \end{align*}
> $
>
> In particular, if the right hand side is finite, then $\seq{X_k}$ converges almost surely.
>
> *Proof*. Assume without loss of generality that $a = 0$, and define the following stopping times for buy low sell high:
> $
> T_0 = 0 \quad S_{k + 1} = \inf\bracs{m \ge T_k: X_m < 0}
> $
> and
> $
> T_{k + 1} = \inf\bracs{m \ge S_{k + 1}: X_m > b}
> $
> then for any $i \ge 1$, $[S_i, T_i]$ is the $i$-th upcrossing of the interval $[0, b]$ by the given supermartingale. Let $S_k \wedge n$ and $T_k \wedge n$ be their bounded variants, then by the [[Optional Stopping Theorem]],
> $
> \ev\braks{X_{T_k \wedge n} - X_{S_k \wedge n}} \le 0
> $
> and we can express the earning as
> $
> X_{T_k \wedge n} - X_{S_k \wedge n} = \begin{cases}
> \ge b & T_k \le n \\
> X_n - X_{S_k}\ge -X_n^{-} &S_k \le n, T_k \ge n \\
> 0 & S_k \ge n
> \end{cases}
> $
> so with $U_n[0, b]$ as the number of upcrossings by time $n$,
> $
> \begin{align*}
> 0 \ge \ev\braks{\sum_{k \ge 0}\paren{X_{T_k \wedge n} - X_{S_k \wedge n}}} &\ge \ev\braks{b U_n[0, b] - X_n^{-}} \\
> \ev\braks{U_n[0, b]} &\le \frac{1}{b}\ev(X_n^-) \le \frac{1}{b}\sup_{n \ge 0}\ev\paren{X_n^-} \\
> \ev\braks{U[0, b]} &\le \frac{1}{b}\sup_{n \ge 0}\ev\paren{X_n^-}
> \end{align*}
> $
> by the [[Monotone Convergence Theorem for Sequences|monotone convergence theorem]].
# Alternate Proof
Let $Z_m = (Y_m - a)^+$, then $Z_m$ is also a submartingale where $Z_{S_j} = 0$ and $Z_{T_j} \ge b - a$. Let $U_M$ be the number of up-crossings completed by time $M$, then
$
U_{M} = \sum_{j = 1}^{U_{M}}1 \le \sum_{j = 1}^{U_{M}}\frac{Z_{T_j}-Z_{S_j}}{b - a} \le \sum_{j = 1}^{M}\frac{Z_{T_j \wedge M}-Z_{S_j \wedge M}}{b - a}
$
which is bounded by
$
\frac{Z_{T_{M} \wedge M}}{b - a} - \sum_{k = 2}^M\frac{Z_{S_{j-1} \wedge M} - Z_{T_{j - 1} \wedge M}}{b - a} - \frac{Z_{S_1 \wedge M}}{b - a}
$
Applying the super-martingale property here shows that the terms to be subtracted are non-negative, so $U_M$ is bounded by the first term.