[proofplan]
We prove the equivalence in two directions. For necessity, we use the definition of the upper and lower integrals as infimum and supremum of upper and lower sums, and combine two partitions via their common refinement using the [Refinement Lemma](/theorems/192). For sufficiency, we squeeze $I^*(f) - I_*(f)$ between $0$ and $S(f,\mathcal{D}) - s(f,\mathcal{D}) < \varepsilon$ for arbitrary $\varepsilon > 0$.
[/proofplan]
[step:Prove necessity: integrability implies the oscillation criterion]
Assume $f$ is Riemann [integrable](/page/Integral), so $I^*(f) = I_*(f) = I$ where $I^*(f) = \inf_{\mathcal{D}} S(f,\mathcal{D})$ is the upper integral and $I_*(f) = \sup_{\mathcal{D}} s(f,\mathcal{D})$ is the lower integral.
Given $\varepsilon > 0$, by definition of infimum there exists a partition $\mathcal{D}_1$ with $S(f, \mathcal{D}_1) < I + \varepsilon/2$. By definition of supremum there exists a partition $\mathcal{D}_2$ with $s(f, \mathcal{D}_2) > I - \varepsilon/2$.
Let $\mathcal{D} = \mathcal{D}_1 \cup \mathcal{D}_2$. Since $\mathcal{D}$ refines both $\mathcal{D}_1$ and $\mathcal{D}_2$, the [Refinement Lemma](/theorems/192) gives
\begin{align*}
S(f, \mathcal{D}) \le S(f, \mathcal{D}_1) < I + \varepsilon/2, \\
s(f, \mathcal{D}) \ge s(f, \mathcal{D}_2) > I - \varepsilon/2.
\end{align*}
Subtracting:
\begin{align*}
S(f, \mathcal{D}) - s(f, \mathcal{D}) < (I + \varepsilon/2) - (I - \varepsilon/2) = \varepsilon.
\end{align*}
[/step]
[step:Prove sufficiency: the oscillation criterion implies integrability]
Assume for every $\varepsilon > 0$ there exists a partition $\mathcal{D}$ with $S(f, \mathcal{D}) - s(f, \mathcal{D}) < \varepsilon$.
For any partition $\mathcal{D}$, we have $s(f, \mathcal{D}) \le I_*(f) \le I^*(f) \le S(f, \mathcal{D})$ (since the lower integral is the supremum of lower sums and the upper integral is the infimum of upper sums). Therefore
\begin{align*}
0 \le I^*(f) - I_*(f) \le S(f, \mathcal{D}) - s(f, \mathcal{D}).
\end{align*}
Given $\varepsilon > 0$, choosing $\mathcal{D}$ with $S(f, \mathcal{D}) - s(f, \mathcal{D}) < \varepsilon$ gives
\begin{align*}
0 \le I^*(f) - I_*(f) < \varepsilon.
\end{align*}
Since $\varepsilon > 0$ is arbitrary, $I^*(f) = I_*(f)$, so $f$ is Riemann integrable.
[guided]
The chain of inequalities $s(f, \mathcal{D}) \le I_*(f) \le I^*(f) \le S(f, \mathcal{D})$ deserves justification. The lower integral is $I_*(f) = \sup_{\mathcal{P}} s(f, \mathcal{P})$, so $s(f, \mathcal{D}) \le I_*(f)$ for any particular partition $\mathcal{D}$. Similarly, $I^*(f) = \inf_{\mathcal{P}} S(f, \mathcal{P}) \le S(f, \mathcal{D})$.
For the middle inequality $I_*(f) \le I^*(f)$: given any two partitions $\mathcal{P}$ and $\mathcal{Q}$, their common refinement $\mathcal{R} = \mathcal{P} \cup \mathcal{Q}$ satisfies
\begin{align*}
s(f, \mathcal{P}) \le s(f, \mathcal{R}) \le S(f, \mathcal{R}) \le S(f, \mathcal{Q})
\end{align*}
by the [Refinement Lemma](/theorems/192). Since $s(f, \mathcal{P}) \le S(f, \mathcal{Q})$ for all $\mathcal{P}$ and $\mathcal{Q}$, taking the supremum over $\mathcal{P}$ gives $I_*(f) \le S(f, \mathcal{Q})$ for all $\mathcal{Q}$, and then taking the infimum over $\mathcal{Q}$ gives $I_*(f) \le I^*(f)$.
With the full chain established, the sufficiency argument is immediate: the hypothesis provides, for each $\varepsilon > 0$, a partition $\mathcal{D}$ with $S(f, \mathcal{D}) - s(f, \mathcal{D}) < \varepsilon$. Inserting the chain:
\begin{align*}
0 \le I^*(f) - I_*(f) \le S(f, \mathcal{D}) - s(f, \mathcal{D}) < \varepsilon.
\end{align*}
Since $\varepsilon > 0$ is arbitrary, $I^*(f) = I_*(f)$, so $f$ is Riemann [integrable](/page/Integral).
[/guided]
[/step]