Is $f(x)=\sin x$ integrable? I'd like to know if the following reasoning to prove that $f(x)=\sin x$ is not integrable is correct, or what's the mistake I'm making.
Consider the following definition and Corollary taken from Folland's Real Analaysis:
Definition: Consider a measure space $(X,M, \mu)$. If $f:X \to \Bbb R$, we say that $f$ is integrable if both $\int_X f^+$ and $\int_X f^-$ are finite. It is clear that $f$ is integrable iff $\int_X |f|<\infty$ since $|f|=f^+ + f^-$.
Corollary 2.2: If $X$ and $Y$ are topological spaces, every continuous $f:X\to Y$ is $(B_X, B_Y)$-measurable, where $B_X$ and $B_Y$ are the Borel $\sigma$-aglebras on $X$ and $Y$, respectively.
Now, the function $f:\Bbb R \to \Bbb R$ defined by $f(x)=\sin x$ is continuous, and by the corollary, it's Borel-measurable.
We have that $\int_{\Bbb R} f = \int_{-\infty}^\infty \sin (x) dx = 0$, but $\int_{\Bbb R} f^+= \int_{\Bbb R} f^-=\infty$, so, $f(x)=\sin x$ is not integrable.
Note: I'm doing this because I'm trying to understand why do we have $\int_X |f|<\infty$ and not $\int_X f<\infty$ in the definition of integrable function, and I'm trying to find a counterexample that $\int_X f<\infty$ doesn't imply $\int_X |f|<\infty$. If someone has a valid counterexample it would be nice to know it.
 A: First of all, $\int_{-\infty}^{\infty} \sin(x)dx=0$ is false. Even if we consider the improper Riemann integral, it is not defined as $\lim_{R\to\infty}\int_{-R}^R f(x)dx$, but as $\lim_{R,M\to\infty}\int_{-M}^R f(x)dx$. So even as an improper Riemann integral $\int_{-\infty}^{\infty} \sin(x)dx$ is divergent.
Anyway, we are discussing the Lebesgue integral here. As you noted correctly the integral is divergent, for example because $f^{+}$ is not integrable.
I'll write a few words about your note. You ask why $\int_X f<\infty$ is not the definition of an integrable function. Well, actually it is, but first of all we have to define what does $\int_X f$ even means for a general measurable function. Thing is, Lebesgue integration is defined in a few steps. Usually it is first defined for non negative measurable functions. After we did that we can define it for a general measurable function $f$: it is called integrable if both integrals $\int_X f^{+}$ and $\int_X f^{-}$ are finite, and then we define $\int_X f=\int_X f^{+}-\int_X f^{-}$. But it is also easy to see that the condition $\int_X f^{+},\int_X f^{-}<\infty$ is equivalent to the condition $\int_X |f|<\infty$ (remember, we already defined the Lebesgue integral for non-negative functions), so we get an equivalent definition of $f$ being integrable that way.
In other words, it is true that $\int_X f$ is a finite number if and only if $\int_X |f|$ is.
A: You have a few definitions mixed up. For any function $f:X\to\mathbb{R}$, the value $\int_{X} f dx = \int_{X}f^+ dx - \int_{X}f^- dx$ is defined only if $ \int_{X}f^+ dx ,  \int_{X}f^- dx < \infty$. Since you noted that $ \int_{X}f^+ dx =  \int_{X}f^- dx = \infty$, the value $\int_{X} dx$ is simply not defined.
The integral $\int_{-\infty}^\infty f(x)dx$ is a Riemann integral and is defined only if the following limits exist $\lim_{m,n\to\infty}=\int_{-m}^n f(x)dx$. What you have noticed is that $\lim_{M\to\infty}\int_{-M}^Mf(x)dx = 0$. But we do not always have $\lim_{M\to\infty}\int_{-M}^Mf(x)dx = \lim_{m,n\to\infty}\int_{-m}^n f(x)dx$
