Solution (source code)

= Solution

For a <partition of an interval> $P:0=x_0<\cdots<x_m=1$, put
$$
M_j=\sup_{x\in[x_{j-1},x_j]}f(x),
\qquad
m_j=\inf_{x\in[x_{j-1},x_j]}f(x).
$$
The <upper Darboux sum> and <lower Darboux sum> are
$$
U(f,P)=\sum_{j=1}^mM_j(x_j-x_{j-1}),
\qquad
L(f,P)=\sum_{j=1}^mm_j(x_j-x_{j-1}).
$$
The upper and lower integrals are
$$
\overline{\int_0^1}f=\inf_PU(f,P),
\qquad
\underline{\int_0^1}f=\sup_PL(f,P).
$$
The bounded function is <Riemann integrable> when these values agree, and their common value is its <Riemann integral>.

For the indicator of the rational numbers, every nondegenerate interval contains both a <rational number> and an <irrational number>. Hence every upper sum is one and every lower sum is zero. The function is not Riemann integrable.