This question was originally posted on MSE (https://math.stackexchange.com/q/3796602/793374), but nobody has found a correct answer in about two weeks, so I decided to repost it here:

In lemma 4.30 of Folland's "A Course in Abstract Harmonic Analysis" (Second Edition) one needs to show the square-integrability of the function $f$ defined below and I don't understand how Folland deduces it from the inequality below.

For context, $G$ is a locally compact abelian Hausdorff group and $dx$ is a Haar measure on $G$ (note that Folland defines Radon measures to be outer regular and inner regular on open sets). Furthermore $f$ is continuous, bounded and a linear combination of functions of positive type (this is encoded in the notation $f \in \mathcal{B}(G)$). Here is what i have tried so far:

With Plancherel's theorem we see (as in Folland's proof) that $$(L^1(G) \cap L^2(G), \|\cdot\|_2) \to \mathbb{C}, \ k \mapsto \int_G f(x) \cdot k(x) \, dx$$ defines a bounded linear functional which extends to a bounded linear functional $F \in L^2(G)^*$ by the BLT theorem (I removed the complex conjugation for linearity; this should not make a difference in the argumentation).

Now Riesz's theorem yields an $r \in \mathcal{L}^2(G)$ such that $F$ is given by integration against $r$, i.e. $$F(k) = \int_G r(x) \cdot k(x) \, dx \ \text{ for all } k \in L^2(G).$$ In particular we have $$\int_G f(x) \cdot k(x) \, dx = \int_G r(x) \cdot k(x) \, dx \ \text{ for all } k \in L^1(G) \cap L^2(G).$$

With this we can show that the set $N := \{x \in G: r(x) \neq f(x)\}$ is locally null with respect to the Haar measure $dx$ since for any Borel set $A \subseteq N$ with finite Haar measure we can set $$k(x) := 1_A(x) \cdot \frac{|f(x) - r(x)|}{(f(x) - r(x)) + 1_{G \setminus N}(x)}$$ to obtain a function $k \in L^1(G) \cap L^2(G)$, so $$0 = \int_G (f(x) - r(x)) \cdot k(x) \, dx = \int_A |f(x) - r(x)| \, dx,$$ i.e. $A \cap N = A$ has Haar measure $0$.

To conclude $f \in L^2(G)$ we now need to show that $N$ has Haar measure $0$ and this problem can be reduced further: The set $$R := \{x \in G: r(x) \neq 0\} = \bigcup_{n \in \mathbb{N}} \{x \in G: |r(x)| \geq \tfrac{1}{n}\}$$ is $\sigma$-finite since $r \in \mathcal{L}^2(G)$, so $R \cap N$ is again $\sigma$-finite and locally null. Hence $R \cap N$ has Haar measure $0$ and we only need to show that the set $$M := (G \setminus R) \cap N = \{x \in G: r(x) = 0 \neq f(x)\}$$ has Haar measure $0$.