I think we can try to define the sets by induction. Put A_1:=\left\{x\in X\mbox{ such that }f(x)\geq 1\right\} andA_n := \left\{x\in X\mbox{ such that }f(x) - \sum_{j=1}^{n-1}\frac 1j\mathbf{1}_{A_j}(x)\geq \frac 1n\right\}.
Let (X, \mathcal{A}) be a measurable space and let f : X \rightarrow [0, +\infty] be a measurable function. Find a set sequence \{A_n\}, A_n \in \mathcal{A}, such that f = \sum{n=1}^{\infty} \frac{1}{n} I_{A_n}, where I_A is a characteristic function.
I guess something's wrong with LaTeX, so I didn't use it.
At first I thought of a sequence A_n = \{ x \in X : f(x) = \frac{1}{n} \}, but it's wrong. Does anyone have any idea? It may be connected to a proof of Theorem 4.4.10 from "An introduction to the Theory of Real Functions" (author: Stanislaw Lojasiewicz), but I can't find out how.