Does Lebesgue integration have the property of countable subadditivity: 'if $f$ is integrable on $E$ and $E = \bigcup_{i=1}^{\infty} E_n$ then $\int_E f \le \sum_{i=1}^{\infty} \int_{E_n} f$'? You would expect so.
I think I have a counterexample: Let $f : [0,1] \to \mathbb{R}$ be the constant function $f(x) = 1$. Let $B_r(x) \subset \mathbb{R}$ be the ball of radius $r$ centred at $x$. Let $q_1, q_2, q_3, ...$ be an enumeration of elements of $\mathbb{Q} \cap [0,1]$. Since the rationals are dense, $\bigcup_{i=1}^{\infty} B_{2^{-i-2}}(q_i)$ covers [0,1].
$\int_{[0,1]} f = 1$. But $\sum_{i=1}^{\infty} \int_{B_{2^{-i-2}}(q_i) \cap [0,1]} f < \sum_{i=1}^{\infty} m(B_{2^{-i-2}}(q_i)) = \sum_{i=1}^{\infty} 2^{-i-2} = \frac{1}{2} < 1$.
Is this correct (i.e., is it actually a counterexample to countable subadditivity?)? Can you think of a better/simpler counterexample?
Edit: Can you explain where my counterexample goes wrong?
Just pick a strictly negative function, let $f(x) = -1$ for all $x$. Then
$$-1=\int_0^1 f\ge \int_0^{2/3}f+\int_{1/3}^1f = -{4\over 3}$$
Your positive function will not do the trick since
$$\int_E1=m(E)$$
So if $\displaystyle\bigcup_{n=1}^\infty E_n=E$
$$\int_Ef\le \sum_{n=1}^\infty \int_{E_n}f \iff m(E)\le \sum_{n=1}^\infty m(E_n)$$
and the latter side is just the definition of monotonicity of a measure.
Edit: The original question was for general things, but let's do positive, since it's just as well.
Write $E_n' = E_n\setminus\displaystyle\bigcup_{i=n+1}^\infty E_i$, so that $E=\displaystyle\bigsqcup_{n=1}^\infty E_n'$. Then
$$\int_E f=\sum_{n=1}^\infty \int_{E_n'}f\le \sum_{n=1}^\infty\int_{E_n}f$$
the last inequality because $E_n = E_n'\sqcup E_n\setminus E_n'$ so that
$$\int_{E_n}f=\int_{E_n'}f+\int_{E_n\setminus E_n'}f$$
and since $f\ge 0$ monotonicity of the integral gives the second summand on the RHS is non-negative.
Your counter-example assumes density implies any collection of balls covering the dense set covers the whole set, which seems intuitively true, but you'll find you cannot prove it (because it is false).