If $f∈C^1$ and $\{∇f=0\}$ has Lebesgue measure $0$, then $\{f∈B\}$ has Lebesgue measure $0$ for all Borel measurable $B⊆ℝ$ with Lebesgue measure $0$ Let $d\in\mathbb N$ and $f\in C^1(\mathbb R^d)$. Assume $\left\{\nabla f=0\right\}$ has Lebesgue measure $0$.

How can we conclude that $\left\{f\in B\right\}$ has Lebesgue measure $0$ for all Borel measurable $B\subseteq\mathbb R$ with Lebesgue measure $0$?

The claim can be found in an answer on mathoverflow.
The author writes that the claim "is true locally, in a neighborhood of each point where $\nabla f\ne0$, due to the implicit function theorem". Honestly, I don't even understand what exactly he's meaning.
Let $a\in\mathbb R^d$ with $\nabla f(a)\ne0$. Then surely, by continuity of $\nabla f$ at $a$, there is an open neighborhood $N$ of $a$ with $$\nabla f(x)\ne0\;\;\;\text{for all }x\in N\tag1.$$ But how do we need to apply the implicit function theorem and what's the resulting "local" conclusion? Maybe that $N\cap\left\{f\in B\right\}$ has Lebesgue measure $0$?
 A: Non-singular maps. A map $f\,:\,\mathbb{R}^N\rightarrow\mathbb{R}^M$ whose inverse image preserves null-sets, -- i.e., $\mu(f^{-1}(B))=0$ for any null-set $B$, -- is often referred to as a non-singular map. The question is about showing that the class of $\mathcal{C}^1$ maps with non-singular Jacobian (or more specifically, non-zero gradient) almost everywhere is contained in the class of non-singular maps. 


Remark. $c\in\mathbb{R}$ is called a regular value of $f\in\mathcal{C}^{1}(\mathbb{R}^d)$, if $\nabla f(x)\neq 0$ for all $x\in f^{-1}(c)$.
  The Implicit Function Theorem (IFT) asserts that $f^{-1}(c)$ is a (d-1)-dimensional submanifold of
  class $\mathcal{C}^1$ -- for any regular value $c$. Hence, $f^{-1}(c)$
  is a null-set.

Let $\widetilde{N}\overset{\Delta}=\left\{\nabla f\neq 0\right\}$ (which is open). 
From the IFT, we have that $\widetilde{N}\cap f^{-1}(c)$ is a (d-1)-submanifold of class $\mathcal{C}^1$.
Now, you have $\widetilde{N}\cap \left\{f\in B\right\}=\bigcup_{t\in B}\widetilde{N} \cap f^{-1}(t)$, where $\widetilde{N} \cap f^{-1}(t)$ is a null-set for all $t$ from the above remark (since it is a $\mathcal{C}^1$ submanifold from the IFT). Therefore, when $B$ is countable, the referred set is a null-set.  
When $B$ is uncountable, it follows from Fubini's Theorem that $\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)$ is a null-set for any bounded open ball $B_r$.
To see this latter claim, we can resort to a more specialized form of Fubini tailored to our case (referred to as co-area formula),
$\int_{\widetilde{N}\cap B_r} g\left|\nabla f\right| d\mu = \int_{\mathbb{R}} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} g(x)d\mu_{d-1}(x)\right) dt$.
Take $g$ to be the indicator of the foliation $\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)$ and note that
$\int_{\mathbb{R}} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} g(x)d\mu_{d-1}(x)\right) dt=\int_{B} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} d\mu_{d-1}(x)\right) dt=0$,
where the last identity holds since $B$ is a null-set. Thus, 
$\int_{\widetilde{N}\cap B_r} g\left|\nabla f\right| d\mu=0$ and therefore $g\left|\nabla f\right|=0$ almost everywhere in $\widetilde{N}\cap B_r$. Since, $\left|\nabla f\right|\neq 0$ almost everywhere, it follows that $g(x)=0$ almost everywhere in $\widetilde{N}\cap B_r$. In other words,
$\mu\left(\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)\right)=\int g d\mu =0$.

Update. For the sake of completeness, I am adding the general statement.

Theorem 1. Let $f\,:\,\mathbb{R}^N\rightarrow \mathbb{R}^M$ be smooth
  (i.e., $f\in\mathcal{C}^1$). If the set of critical points of $f$ is
  a null-set, i.e.,
$\mu\left(\left\{x\in\mathbb{R}^N : \text{rank} \left(Df(x)\right)<\min\left\{M,N\right\}\right\}\right)=0,$
then, $\mu\left(f^{-1}(B)\right)=0$ for any null-set $B$.

The proof follows from the IFT and Fubini (or, more precisely, the co-area formula) just as done before.

Update 2. I am adding a Corollary.
Definition. [Null-sets on manifolds] Let $\mathcal{V}$ be a smooth manifold of dimension $d$ with smooth structure $\left\{U_{\alpha},\varphi_{\alpha}\right\}$. $A\subset \mathcal{V}$ is called a null subset of $\mathcal{V}$ if $\mu\left(\varphi_{\alpha}(U_{\alpha}\cap A)\right)=0$ for all $\alpha$. 
Relevant Property. If $\mu(\widehat{A})=0$ with $\widehat{A}\subset \mathbb{R}^d$ then,
$\varphi^{-1}_{\alpha}(\widehat{A})$ is a null-set for any $\alpha$. This follows by observing that $\varphi_{\beta}\left(U_{\beta}\cap\varphi^{-1}_{\alpha}(\widehat{A})\right)=\varphi_{\beta}\circ \varphi^{-1}_{\alpha}(\widehat{A})$ is necessarily a null-set, for any $\beta$, since $\widehat{A}$ is a null-set and $\varphi_{\beta}\circ \varphi^{-1}_{\alpha}$ is a diffeomorphism -- hence, from Theorem 1, $\varphi_{\beta}\circ \varphi^{-1}_{\alpha}(\widehat{A})$ is a null-set.
In the next corollary, we assume that the manifolds admit countable atlas -- i.e., are separable.

Corollary 1. Let $f\,:\,\mathcal{M}\rightarrow \mathcal{N}$ be a smooth map
  between two smooth separable manifolds $\mathcal{M}$, $\mathcal{N}$ of dimensions $M$ and $N$, respectively. If the set of critical points of $f$ is a null-set, then $f^{-1}(B)$ is a null-set for any null-set $B$.

For the proof, one just needs to notice that any local coordinate representation of $f$ fulfills the conditions of Theorem 1. 
A: I don't know about the implicit function theorem, but you can a one related theorem, the Local Submersion Theorem. With your notations, locally around $a$, $f$ looks like a projections onto the first coordinate. You are left to prove that $$p:(x_1,\dots,x_d)\in\Bbb{R}^d\mapsto x_1$$
has the property that $$(B\text{ has measure zero})\Longrightarrow (\{p\in B\}\text{ has measure zero}).$$
But $\{p\in B\}=B\times\Bbb R^{d-1}$ so you can conclude.
