# Understanding the Lebesgue criterion for Riemann-integrability

The Lebesgue criterion for Riemann-integrability of a function $$f \colon \mathcal{D} \subseteq \mathbb{R} \longrightarrow \mathbb{R}$$ states that a function is Riemann-integrable in a compact $$\mathcal{D}$$ when the set of discontinuities of $$f$$ in $$\mathcal{D}$$ has Lebesgue measure $$0$$.

I'm not sure I fully understand this, maybe because I haven't yet seen a rigorous prove of it, and here's why: the Dirichlet function

$$1_\mathbb{Q}(x) = \left\{\array{1 & x\in\mathbb{Q} \\ 0 & x \notin\mathbb{Q}}\right.$$

is continuous nowhere, but it would be continuous if a $$0$$-Lebesgue measure changed (if the function evaluated at the rationals was also $$0$$). This function is not Riemann-integrable in any compact subset of $$\mathcal{D}$$, though, so... why?

Maybe it's because this function is continuous nowhere, and not continuous "everywhere but in a $$0$$-measure set", but is it even possible to have a function continuous at the irrationals and not continuous at the rationals?, and would such a function be Riemann-integrable?

Since the function is continuous nowhere, the Lebesgue measure of the discontinuous points say on $$[0,1]$$ is 1, and since this Lebesgue measure is nonzero, and noting also that the theorem is an i.f.f., we know that the function is not Riemann integrable on $$[0,1]$$.
The fact that you can change a 0-Lebesgue measure is not relevant to the use of the Lebesgue criterion, because it changes the function fundamentally. In fact something like Lusin's Theorem shows that it can be always done in an $$\epsilon$$ set. (Although I am sweeping quite a lot of details under the rug, like relative topology, etc.) See https://en.wikipedia.org/wiki/Lusin%27s_theorem for details.