Conditional expectation and the Dirac delta function I'm looking for a rigorous proof of an identity I came across many times (in the context of Gÿongy's lemma).
Suppose $X$ and $Y$ are two r.v. 
We know that $\mathbb{E}\left[X|Y\right]$ is $\sigma(Y)$-measurable so there exist a function $\varphi$ such that $\mathbb{E}\left[X|Y\right]=\varphi(Y)$. We define $\mathbb{E}\left[X|Y=y\right] := \varphi(y)$.
The identity I'm after is then the following:
$$
\mathbb{E}\left[X|Y=y\right] = \frac{\mathbb{E}\left[X\delta(Y-y)\right]}{\mathbb{E}\left[\delta(Y-y)\right]}
$$
Where $\delta$ is the Dirac delta distribution.
I intuitively think this may be traced back to
$$
p_\left[X|Y\right] = \frac{p_\left[X,Y\right]}{p_\left[Y\right]}
$$
where $p_\left[X|Y\right]$ is the probability distribution of $\mathbb{E}\left[X|Y\right]$, $p_\left[X,Y\right]$ the joint probability distribution of $(X,Y)$, and $p_\left[Y\right]$ the marginal distribution of $Y$.
Any help would be appreciated.
 A: If we interpret $\delta(Y-y)$ as $1_{\{Y=y\}}$ (the random variable which is $1$ on the event $\{Y=y\}$ and $0$ otherwise), then the formula is true as written for any discrete random variable $Y$.
Suppose $X$ and $Y$ are real-valued random variables with a joint density $f(x,y)$ on $\mathbb{R}^2$. Let us interpret $E[g(X)\delta(Y-y)]$ as
$$
\int_{\mathbb{R}} g(x)f(x,y)\,dx.
$$
Then $E[\delta(Y-y)]=\int_{\mathbb{R}}f(x,y)\,dx$. If we define
$$
\varphi(y) = \frac{E[X\delta(Y-y)]}{E[\delta(Y-y)]}
$$
whenever $E[\delta(Y-y)]>0$, and $\varphi(y)=0$ otherwise, then $E[X\mid Y]=\varphi(Y)$.
These results are Propositions 6.39 and 6.41 in these notes. In the latter case, we can use the Lebesgue differentiation theorem to prove that for Lebesgue almost every $y\in\mathbb{R}$, if $E[\delta(Y-y)]>0$, then
$$
E[X \mid Y \in (y - \varepsilon, y + \varepsilon)]
  = \frac{E[X1_{\{|Y-y|<\varepsilon\}}]}{E[1_{\{|Y-y|<\varepsilon\}}]}
  \to \frac{E[X\delta(Y-y)]}{E[\delta(Y-y)]}
$$
as $\varepsilon\to0$. 
