The following theorem is found, for example, in the Real Analysis books by Folland, by Yeh, and (in a slightly different form) by Royden.
Theorem. Let $(X,\mathcal{A},\mu)$ be a measure space.
Let $S_0$ be the space of all measurable simple functions which vanish outside a set of finite measure. Let $g:X \to \mathbb{R}$ be a measurable function. Assume $\{ x: g(x) \neq 0 \}$ is $\sigma$-finite. Assume $fg \in L^1$ for all $f \in S_0$.
Let $1 \leq p,q \leq \infty$ be conjugate exponents (i.e., $p^{-1} + q^{-1} = 1$).
Then
$$
\|g\|_q = \sup\left\{ \left|\int fg \right| : f \in S_0, \, \|f\|_p=1 \right\}.
$$
For brevity below, denote the supremum by $M_q(g)$.
Notice that we do not assume $g \in L^q$.
My question is about the assumption that $fg \in L^1$ for all $f \in S_0$.
Question. Is it necessary to have the assumption that $fg \in L^1$ for all $f \in S_0$?
First, it seems that its fine if we only require $\int fg$ to be defined (meaning it could be finite or infinite). This is because if $\int fg = \pm \infty$ for some $f$, then the supremum $M_q(g)$ equals $+\infty$, so $\|g\|_q \leq M_q(g)$ holds trivially. The reverse inequality is just Holder.
But what if we don't have the assumption that $\int fg$ is defined for all $f \in S_0$? I see that without that assumption, the set whose supremum we are taking doesn't really make sense since the integral may not be defined. But could we drop the hypothesis and instead introduce some convention in the definition of the set, like (for example) we only consider $f$ such that $\int fg$ is defined? Is it possible to have $\|g\|_q = \infty$ but $M_q(g) < \infty$ when we adopt a convention like the one described above. In the extreme case, is it possible to $\|g\|_q = \infty$ but $\int fg$ undefined for every $f \in S_0$?
Cross-Posted over at MO after several days of inactivity here: https://mathoverflow.net/q/356844/150527
It's sufficient to take the supremum over those $f \in S_0$ for which $fg \in L^1$.
Consider two cases: either $g$ is locally integrable ($L^1_{\mathrm{loc}}$) or it's not.
If $g \in L^1_{\mathrm{loc}}$ then we have $fg \in L^1$ for every $f \in S_0$ and we can proceed as before.
If $g \notin L^1_{\mathrm{loc}}$, then in particular $g \notin L^q$, so we have to show the supremum is infinite. By definition of $g \notin L^1_{\mathrm{loc}}$ there exists a set $A$ of finite measure such that (replacing $g$ by $-g$ if necessary) we have $\int_A g^+ = +\infty$. For each $n$, let $A_n = A \cap \{0 < g^+ < n\}$ and $f_n = \mu(A_n)^{-1/p} 1_{A_n}$. Clearly $f_n \in S_0$ and $\|f_n\|_p = 1$; moreover, we have $0 \le f_n g \le n \mu(A_n)^{-1/p}$, so $f_n g \in L^1$. Now $\int f_n g = \mu(A_n)^{-1/p} \int_{A_n} g^+ \ge \mu(A)^{-1/p} \int_{A_n} g^+$. By monotone convergence, we have $\int_{A_n} g^+ \to \int_A g^+ = \infty$.
So if you redefine $M_q(g)$ to take the supremum over only those $f \in S_0$ for which $fg \in L^1$ (an even smaller set than those for which $\int fg$ is defined), it still equals $\|g\|_q$ in all cases.
Well, that's trivially not possible, because you could always take $f=0$. But the above argument also shows how to get a fairly "rich" set of $f \in S_0$ for which $fg \in L^1$; namely, have $f$ supported on some set where $g$ is bounded. And you can write $X$ as a countable union of such sets.