I am studying Donald Cohn's Measure Theory. In Chapter 3, Exercise 7, the author asks to do the following exercise:
Let $(X, \mathcal A , \mu)$ be a finite measure space, and let $f$ be an $\mathcal A$ measurable real or complex valued function on $X$.
Show that $f$ belongs to $\mathscr L ^ \infty$ iff
- $f$ belongs to $\mathscr L^p (X,\mathscr A , \mu)$ for each $p \in [1, \infty )$ and
- $\sup \{ \lVert f \rVert _p : 1\le p < +\infty \}$ is finite.
Cohn defines $\mathscr L^p$ for $1\le p < \infty$ in the usual fashion. However, $\mathscr L ^\infty$ is the collection of all bounded measurable functions (this is different from what Wikipedia and other textbook do) and $\lVert f \rVert _\infty$ is defined to be the infimum of those nonnegative numbers $M$ such that $\{ x\in X : |f(x)| > M \}$ is locally null. (See here the definition of locally null)
I successfully proved the "only if" part. To prove the "if" part, I need to prove that if any measurable function on a finite measure space which satisfies conditions $1$ and $2$ of the question then it must be bounded.
However, I have a counterexample. Let's consider $X= (0,1]$, $\mathscr A$ is the Borel sigma algebra on $X$ and $\lambda$ is the Lebesgue measure on $X$. Consider the function $f$ on $X$ given by
$$f(x)= \begin{cases} n & \text{if } x=m/n \text{ with } \gcd(m,n)=1 \newline 0 & \text {otherwise} \end{cases}$$
Notice that $f$ is zero almost everywhere and $f$ is measurable because $f= \sum_{p/q \in \mathbb Q \cap (0,1]} q\chi_{\{ p/q\}}$ (and hence is a limit of simple measurable functions). But this function satisfies both conditions 1 and 2 however is not bounded.
Is my counterexample correct? If it is, can the hypothesis of the question be tweaked so the the assertion becomes correct?