$\{f=a\}$ as a test set for a function $f$ to be measurable? I would like to know whether $\{f=a\}$ can be taken as a test set for a function $f$ to be (Lebesgue) measurable, and I vote for a negative answer.
Let me introduce a counter-example. Consider the non-measurable subset $\mathcal N$ of $[0,1]$ constructed via the axiom of choice (for a reference, see the book by Stein and Shakarchi) and let $f$ be an injection defined on $[0,1]$ with $f(x)$ positive when and only when $x\in\mathcal N$. Since $f$ is injective, each $f^{-1}(\{a\})$ is either the empty set or a singleton, which assures that $f^{-1}(\{a\})$ is a measurable set. Nonetheless, $\{f>0\}$ is the non-measurable set $\mathcal N$. This violates the criterion for a function to be measurable.
Is my argument correct? Thank you.
 A: You are right. Such test is not enough. Define $f:[0,1]\rightarrow\mathbb{R}$ by $f(x)=\frac{x}{2}+1_{\mathcal{N}}(x)$,
where $\mathcal{N}\subseteq[0,1]$ is a non-Lebesgue-measurable set.
We go to check that $f$ is injective. Let $x_{1},x_{2}\in[0,1]$
with $f(x_{1})=f(x_{2})$. Suppose that one of them in $\mathcal{N}$
and the other one in $\mathcal{N}^{c}$, say $x_{1}\in\mathcal{N}$
and $x_{2}\in\mathcal{N}^{c}$, then $\frac{x_{1}}{2}+1=\frac{x_{2}}{2}\leq\frac{1}{2}$
which is impossible. Therefore either they are both in $\mathcal{N}$
or both in $\mathcal{N}^{c}$. If $x_{1},x_{2}\in\mathcal{N}$, then
we have $\frac{x_{1}}{2}+1=\frac{x_{2}}{2}+1\Rightarrow x_{1}=x_{2}$.
If $x_{1},x_{2}\notin\mathcal{N}$, then $\frac{x_{1}}{2}=\frac{x_{2}}{2}\Rightarrow x_{1}=x_{2}$.
This shows that $f$ is injective.
If such test is enough, then $f$ is Lebesgue measurable because $\{x\mid f(x)=a\}$
is either empty or is a singleton. Finally, $1_{\mathcal{N}}(x)=f(x)-\frac{x}{2}\Rightarrow1_{\mathcal{N}}$
is Lebesgue measurable too because $x\mapsto\frac{x}{2}$ is Lebesgue
measurable and the sum of Lebesgue measurable functions is Lebesgue
measurable. Finally $\mathcal{N}=\{x\mid1_{\mathcal{N}}(x)=1\}$ which
is not Lebesgue measurable, a contradiction!
