Question regarding $\mathscr L^\infty$ and an exercise in Cohn's textbook 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?
 A: Let us check whether we are all on the same page (literally!).
From page 92 of Donald L. Cohn, Measure Theory (second edition 2013):

Let $\mathscr{L}^\infty(X, \mathscr{A}, \mu, \mathbb{R})$ be the set
of all bounded real-valued $\mathscr{A}$-measurable functions on
$X,$ and let $\mathscr{L}^\infty(X, \mathscr{A}, \mu, \mathbb{C})$
be the set of all bounded complex-valued $\mathscr{A}$-measurable
functions on $X.$ [$\ldots$]
In discussions that are valid for both real- and complex-valued
functions we will often use $\mathscr{L}^p(X, \mathscr{A}, \mu)$ to
represent either $\mathscr{L}^p(X, \mathscr{A}, \mu, \mathbb{R})$ or
$\mathscr{L}^p(X, \mathscr{A}, \mu, \mathbb{C}).$

Footnote on same page:

Some authors define
$\mathscr{L}^\infty(X, \mathscr{A}, \mu, \mathbb{R})$ and
$\mathscr{L}^\infty(X, \mathscr{A}, \mu, \mathbb{C})$ to consist of
functions $f$ that are essentially bounded, which means that
there is a nonnegative number $M$ such that
$\{x \in X : |f(x)| > M\}$ is locally $\mu$-null [$\ldots$]. For most
purposes, it does not matter which definition of
$\mathscr{L}^\infty$ one uses. [$\ldots$]

Main text, continued from page 92 to page 93:

We can define $\|\cdot\|_p$ in the case where $p = +\infty$ by
letting $\|f\|_\infty$ be the infimum of those nonnegative numbers
$M$ such that $\{x \in X : |f(x)| > M\}$ is locally $\mu$-null.
Note that if $f \in \mathscr{L}^p(X, \mathscr{A}, \mu),$ then
$\{x \in X : |f(x)| > \|f\|_\infty\}$ is locally $\mu$-null, for if
$\{M_n\}$ is a nonincreasing sequence of real numbers such that
$\|f\|_\infty = \lim_nM_n$ and such that for each $n$ the set
$\{x \in X : |f(x)| > M_n\}$ is locally $\mu$-null, then the set
$\{x \in X : |f(x)| > \|f\|_\infty\}$ is the union of the sets
$\{x \in X : |f(x)| > M_n\}$ and so is locally $\mu$-null.  Thus
$\|f\|_\infty$ is not only the infimum of the set of numbers $M$
such that $\{x \in X : |f(x)| > M\}$ is locally $\mu$-null but is
itself one of those numbers.

Exercise 3.3.7, on page 98:

Let $(X, \mathscr{A}, \mu)$ be a finite measure space, and let
$f$ be an $\mathscr{A}$-measurable real- or complex-valued function
on $X.$

*

*(a) Show that $f$ belongs to $\mathscr{L}^\infty(X, \mathscr{A}, \mu)$
if and only if:

*

*(i) $f$ belongs to $\mathscr{L}^p(X, \mathscr{A}, \mu)$ for each $p \in [1, +\infty),$ and


*(ii) $\sup\{\|f\|_p : 1 \leq p < +\infty\}$ is finite.




*(b) Show that if these conditions hold, then
$\|f\|_\infty = \lim_{p \to +\infty}\|f\|_p.$

[I don't know how to nest lists properly in a blockquote in Markdown. Feel free to correct my formatting.]
There would be nothing wrong with the exercise if $\mathscr{L}^\infty(X, \mathscr{A}, \mu)$ were defined as in the footnote, but it is defined differently in the main text, and according to that definition, the OP's counterexample is valid.
