Separability of $L^p$ space: general proof. I am studying the separability of $L^p$ spaces, where $p\in [1,+\infty)$. On the texts I am reading it is shown only that the $L^p(\mathbb{R},\mathcal{L}(\mathbb{R}),\lambda)$, where $\lambda$ is the Lebesgue measure, or that $L^p(E,\mathcal{L}(\mathbb{R^n\cap E}),\lambda_n)$, where $E\subseteq\mathbb{R}^n$ ia an open subset with the usual topology spaces, are separable.
I'm looking for some text where something more general is said: for example:

Let $(X,\mathcal{A},\mu)$ a measure space such that:
$(i)\;$ the measurable space $(X,\mathcal{A})$ is separable;
$(ii)\;$ the measure $\mu$ is $\sigma-$ finite;
then for each $p\in [1,\infty)$ the $L^p(X,\mathcal{A},\mu)$ is separable.

Also I would need an example whereby if you assume that the measure $\mu$ is not $\sigma-$ finite then don't make the statement.
Thanks in advance!
 A: As a counter example to separability of $L_p$ ($1\leq p<\infty$) consider the real line with the co-countable $\sigma$-algebra ($A$ is measurable if either $A$ is countable or $\mathbb{R}\setminus A$ is countable). This is space is not even $\sigma$--finite.

A set of notes where one can see things written formally and precisely (in the words of the OP) is
https://www.math.tamu.edu/~schlump/lecture24and25.pdf
The author shows that under the conditions stated in the OP, the space $L_p(\mu)$ is isometrically isomorphic to $L_p[0,1]\oplus\ell_p(I)$ for some countable set $I$. In addition, if there $\mu$ has no atoms, then $L_p$ is isometrically isomorphic to $L_p[0,1]$. The desired conclusion of the OP will follow from here as step functions with rational coefficients and rational closed intervals as bases are dense. This is a big result! It gives you more than what you asked for.

If the space $\mathcal{A}$ is countable generated and the measure $\mu$ is finite, a simple direct proof to the separability of $L_p$ ($1\leq p<\infty$) can be derived with our resorting to the strong result of Schlump. Here is a sketch of a proof:

*

*It suffices to assume $\mu$ is finite.

*Suppose $\mathcal{C}=\{C_n:n\in\mathbb{N}\}$ generates $\mathcal{A}$. Define $\mathcal{A}_n$ to be the algebra generated by $\{C_1,\ldots,C_n\}$. Each $\mathcal{A}_n$ is finite; hence $\hat{A}=\bigcup_n\mathcal{A}_n$ is a countable algebra that generates $\mathcal{A}$.

*construct the outer measure $\mu^*(E)=\inf\{\sum_n\mu(A_n): A_n\in\hat{\mathcal{A}}, ,E\subset\bigcup_nA_n\}$. The procedure of Carathéodory will produce a complete measure that extends $\mu$ to a larger $\sigma$-algebra $\mathcal{M}\supset\mathcal{A}$

*From this construction, you can see that any measurable set can be approximate by sets in $\hat{\mathcal{A}}$, that is $(X,\mathcal{M})$ is separable.

*The conclusion follows by taking rational linear combinations of sets (indicator functions rather) in $\hat{\mathcal{A}}$.


Edit: I just learned that this question, not surprisingly, has been addressed before in this site. The proof is more pedestrian compared to the much stronger result in Schlump's notes, for the former works under the assumption that $(X,\mu)$ is separable, and the later works under the assumption that $\mathcal{A}$ is countably generated. Countably generated $\mathcal{S}$ implies separability of $(X,\mathcal{S})$ (but that requires a proof, which I furnished above).
