# Why is this set measurable?

I'm trying to understand the proof of Theorem 16.10, Probability and Measure, Patrick Billingsley, I put part of it here exactly as presented in the book

Theorem: If $$f,g$$ are nonnegative and $$\int_Afd\mu=\int_Agd\mu$$ for all $$A$$ in $$\mathscr{F}$$, and $$\mu$$ is $$\sigma$$-finite, then $$f=g$$ almost everywhere

Proof: Suppose that $$f$$ and $$g$$ are nonnegative and that $$\int_Afd\mu\leq\int_Agd\mu$$ for all $$A$$ in $$\mathscr{F}$$. If $$\mu$$ is $$\sigma$$-finite, there are $$\mathscr{F}$$-sets $$A_n$$ such that $$A_n\uparrow\Omega$$ and $$\mu(A_n)<\infty$$. If $$B_n = [0\leq g, then the hypothesized inequality applied to $$A_n\cap B_n$$ implies $$\int_{A_n\cap B_n}fd\mu\leq\int_{A_n\cap B_n}gd\mu< \infty$$ (finite beacuse $$A_n\cap B_n$$ has finite measure and $$g$$ is bounded there) and hence $$\int I_{A_n\cap B_n}(f-g)d\mu=0 \ldots$$ (the proof continues)

I understand everything that follows except from one part when the author uses the fact that $$B_n = [0\leq g is a measurable set. Why is this a measurable set? Thanks in advance

I'm not quite familiar with your notation, but I think this is another way writing $$B_n$$: $$B_n:= \{ x\in X \mid 0 \leq g(x) < f(x) \text{ and } g \leq n\}$$ If that's correct, then note that: $$B_n = \{x \in X \mid g(x) \geq 0\} \cap \{x \in X \mid (f-g)(x) > 0\} \cap \{x \in X \mid g(x) \leq n\} \\ = g^{-1}([0,\infty)) \cap (f-g)^{-1}((0,\infty)) \cap g^{-1}((-\infty,n])$$ But all of the sets in the last expression are measurable as $$g, f-g$$ are both measurable (difference of measurable functions is measurable) and hence $$B_n$$ is measurable.
The set $$B_n$$ can be written as $$B_n = \{g \gt 0\}\cap\{g \lt f\} \cap\{g \le n\}$$. The first and third sets are measurable by definition. For the second one, notice that $$g < f \iff \exists r \in \mathbb Q$$ such that $$g < r < f$$, so $$\{g \lt f\} = \bigcup_{r\in\mathbb Q} \{g < r\}\cap\{f > r\}$$ Which is a countable union of measurable sets.