Upper and lower peak convergence criterion (source code)

= Upper and lower peak convergence criterion
{title2=$a_n\to L\iff a_{k_r}\to L\text{ and }a_{m_r}\to L$}

Suppose $k_1<k_2<\cdots$ are <peaks of a sequence> $(a_n)$ and $m_1<m_2<\cdots$ are <peaks of a sequence> $(-a_n)$. Then $(a_n)$ converges precisely when these two <subsequences> have a common finite <limit of a sequence> $L$.

Necessity follows because every <subsequence> inherits the <limit of a sequence> of a <convergent sequence>. For sufficiency, choose one selected value from each <subsequence> within $\varepsilon$ of $L$. Every term after both selected indices lies between the two selected values:
$$
L-\varepsilon<a_{m_r}\leq a_n\leq a_{k_r}<L+\varepsilon\qquad(n>\max\{k_r,m_r\}).
$$
This is exactly $a_n\to L$.