In the following question
Is a random variable constant iff it is trivial sigma-algebra-measurable?,
whose answer I copy here it is proven that
If $F=\{\emptyset, A\}$, then $f$ is $F$-measurable $\iff f$ is a constant
If $f==c$ is constant it is ALWAYS measurable (for any sigma-algebra). This holds as $f^{-1}[C]$ is $X$ if $c \in C$ and empty if $c \notin > C$. And both sets are in any sigma-algebra.
On the other hand, if $f$ is $F$-measurable and non-constant, then it assumes at least two values $c_1$ and $c_2$. The set $f^{-1}[{c_1}]$ must be in $F$ (by being $F$-measurable, as ${c_1}$ is a closed set) but this set is non-empty (as $c_1$ IS a value of $f$) and not $X$ (as the points $x$ where $f$ assumes the value $c_2$ are not in it). So this set cannot be in $F$, and so $f$ must be constant.
However in my probability lecture this property was given like this
$F=\{\emptyset, A\}$, then $f$ is $F$-measurable $\iff f$ is an a.e (almost everywhere) constant, f being a random variable
Is this a generalization? How do I prove it? I ended up proving it without the a.e, just as in the reference question, and I don't know how to deal with the a.e to make it more general. For instance in the converse: If $f=c$ a.e then there should be sets $N$ with null measure for wich the function is not equal to c, So when I take a borel set B and do the preimage $f^{-1}(B)$ what happens if N \subset B? this leads to the additional question of what is the preimage of a negligible set?