On Spivak "Calculus on Manifolds" p.58 he provides a general version of Fubini theorem. Which I present below (I omit parts that are not important to the question):
Let $A\subset \mathbb{R}^n$ and $B\subset \mathbb{R}^n$ be closed retangles, and let $f:A\times B \rightarrow \mathbb{R}$ be integrable. For $x\in A$ and $y\in B$, and let \begin{equation} \mathscr{L}(x) = \mathbf{L} \int_B f(x, y) dy \end{equation} denote the lower integral of $f$ on $y\in B$. Then $\mathscr{L}$ is integrable on $A$ and: \begin{equation} \int_{A\times B} f = \int_A \mathscr{L} = \int_A \left(\mathbf{L} \int_B f(x, y) dy \right) dx \end{equation}
He gives the following remarks:
- [Not relevant for this question]
- In practive it is often the case that $h(x) = \int_B f(x, y) dy$ is integrable, so that: \begin{equation} \int_{A\times B} f = \int_{A} \left(\int_B f(x, y) dy\right) dx \end{equation} can be applied. This certainly occurs if $f$ is continuous.
- The worst irregularity commonly encontered is that $h(x)$ is not integrable for a finite number of $x\in A$. In this case, $\mathscr{L}(x) = \int_B f(x, y) dy$ for all but these finitely many $x$. Since $\int_A\mathscr{L}$ remains unchanged if $\mathscr{L}$ is redefined at a finite number of points we can still write $\int_{A\times B} f = \int_{A} \left(\int_B f(x, y) dy\right) dx$, provided that $\left(\int_B f(x, y) dy\right)$ is defined arbitrarily, say as 0, when it does not exist.
- Let $f:[0, 1] \times [0, 1]\rightarrow \mathbb{R}$ be defined by: \begin{equation} f(x, y) = \begin{cases} 1 & \text{if }x\text{ is irrational} \\ 1 & \text{if }x\text{ is rational and }y\text{ is irrational}\\ 1-\frac{1}{q} & \text{if }x = p/q\text{ in lowest terms and }y\text{ is rational} \end{cases} \end{equation} Then $f$ is integrable and $\int_{[0, 1]\times[0, 1]} f = 1$. Now $\int_{0}^1 f(x, y) dy = 1$ if $x$ is irrational and does not exist if $x$ is rational. Therefore $h$ is not integrable if $h(x) = \int_{0}^1 f(x, y) dy$ is set equal to zero when the integral does not exist.
My question are:
- On remark 3, why does it need to be a finite number of points? If we had any set with measure 0, wouldn't that be enough to just define $h(x) = 0$ on those points, and in this case, the equality: \begin{equation} \int_A \mathscr{L}(x) = \int_A h(x) \end{equation} would still hold.
- On remark 4, why $\int_0^1 f(x, y) dy$ does not exist for $x$ rational? The set of discontinuities in this case has measure 0 and by theorem 3-8 of the same book this would be enough to guarantee the existance of this integral, wouldn't it?
Seeing as there is already an answer for your question (2), I'll address (1). Spivak already proved that $\mathscr{L}$ is integrable on $A$. The key thing is if you redefine $\mathscr{L}$ at finitely many points of $A$, then it is still integrable on $A$, and \begin{equation} \int_A \mathscr{L}_{\text{new}} = \int_A \mathscr{L}_{\text{old}}. \end{equation} However, if you redefine an integrable function at infinitely many points (even if it only has measure zero) the result may not be integrable, as the following example shows:
Consider $\phi: [0,1] \to \mathbb{R}$, $\phi(x) = 0$, which is clearly integrable, and its modification $\psi: [0,1] \to \mathbb{R}$, \begin{equation} \psi(x) = \begin{cases} 1 & \text{if $x \in \mathbb{Q}$} \\ 0 & \text{if $x \notin \mathbb{Q}$} \end{cases} \end{equation} Notice that $\psi$ is obtained from $\phi$ by redefining it on a subset of the rationals, which are countable and hence have measure zero. However, $\psi$ is nowhere continuous, and hence not integrable (I'm using the fact that Riemann-integrability is equivalent to set of discontinuities having measure zero). So it doesn't make sense to say \begin{equation} \int_0^1 \phi = \int_0^1 \psi \end{equation} If however, you can prove that even after redefining $\mathscr{L}$ on a set of measure zero, it remains integrable, then yes the equation you wrote is true.