We are in $L^p(\mu)$. Where $(\Omega, \mathcal{A},\mu)$ is an arbitrary measure-space. We have a bounded linear functional in this space $l$, by Riesz representation theorem we have that for $f\in L^P(\mu)$:
$l(f)=\int_\Omega f gd\mu$, where $g \in L^q(\mu)$, 1/p+1/q=1.
I want to prove that $g$ is unique a.e., but I am stuck in one place, my attempt:
Assume for contradiction that $g_1,g_2$ gives us our linear functional, but $E=\{x: g_1\ne g_2\}$, has measure larger than $0$. Then either $E_r=\{x: \Re(g_1)\ne \Re(g_2)\}$ has measure larger than zero, or $E_i$ has measure larger than zero (the imaginary counterpart).
Assume that $E_r$ has measure larger than zero, a similar argument follows if $E_i$ has measure larger than zero. Then we have that either $E_r^1=\{x: \Re g_1>\Re g_2\}$ has measure larger than zero, or $E_r^2=\{x: \Re g_1<\Re g_2\}$ has measure larger than zero.
Assume that $E_r^1$ has measure larger than zero. Then by using the trick where we write it as the union of sets where $\Re g_1 > \Re g_2+1/n$, we get that $E_r^{1,\epsilon}=\{x: \Re g_1>\Re g_2+\epsilon\}$, has measure larger than zero.
Now comes the tricky part, if it happens that $E_r^{1,\epsilon}$, has finite measure, then the function $\mathcal{X}_{E_r^{1,\epsilon}}$ is in Lp, and then it is very easy to se that $\int \mathcal{X}_{E_r^{1,\epsilon}}g_1d\mu\ne\int\mathcal{X}_{E_r^{1,\epsilon}}g_2d\mu$ since they have a different real part by construction. And hence we have a contradiction, becuase both integrals are supposed to be the same since they represent the same value for the linear functional.
But what do we do if $\mu(E_r^{1,\epsilon})=\infty$?
If I could assume $\sigma$-finiteness it would be clear, but in the general case, I am not quite sure how to make our set have finite measaure, but not zero?
Any hints?
Note that if $\mu(E_r^{1,\epsilon})=\infty$, then $\chi_{E_r^{1,\epsilon}}$ is not in $L^p(\mu)$.
Remember that the argument you are using requires test functions, but only test functions for which $l(f)$ is defined. If $f\notin L^p(\mu)$, then it is not a case you need to consider.