TITLE: When do the measure-theoretic and elementary definitions of conditional probability/expectation coincide?
QUESTION [10 upvotes]: Suppose $(\Omega, \mathcal{A}, P)$ is the sample space and $X: (\Omega, \mathcal{A}) \rightarrow (\mathbb{R}, \mathcal{B})$ is a random variable. 

Using language of measure theory,
$P(A \mid X)$, the conditional
probability of an event given a
random variable, is defined from
conditional expectation as $E(I_A
    \mid X)$. So $P(\cdot \mid X)$ is in
fact a mapping $\mathcal{A} \times
    \Omega \rightarrow [0,1]$.
In elementary probability, we
learned that $$P(A \mid X \in B): =
    \frac{P(A \cap \{X \in B\})}{P(X \in
    B)}.$$ If I understand correctly,
this requires and implies $P(X \in B) \neq 0$. So 
$P(\cdot \mid X \in \cdot)$ is in
fact a mapping $\mathcal{A} \times
    \mathcal{B} \rightarrow [0,1]$.

My questions are: 

When will $P(\cdot \mid X)$ in the
first definition and $P(\cdot \mid X
    \in \cdot)$ in the second coincide/become consistent
with each other and how?
Is there some case when they can
both apply but do not agree with
other? Is the first definition a more
general one that include the second
as a special case?
Similar questions for conditional
expectation. 

In elementary probability, $E(Y \mid    X \in B)$ is defined as
expectation    of $Y$ w.r.t. the
p.m. $P(\cdot \mid    X \in B)$. So
$E(Y \mid X \in \cdot)$    is a
mapping $\mathcal{B} \rightarrow   
    \mathbb{R}$.
In measure theory,  $E(Y \mid X )$ is    a random variable $\Omega
    \rightarrow    \mathbb{R}$.

I was also wondering how $E(Y \mid X
    \in \cdot)$ in elementary
probability and $E(Y \mid X )$ in
measure theory can coincide/become
consistent? Is the latter a general
definition which includs the former
as a special case?

Thanks and regards!

REPLY [3 votes]: $$\int_C P(A|X)(\omega)dP(\omega)=\int_C E(I_A|X)(\omega)dP(\omega)=\int_C I_A(\omega)dP(\omega)=P(A\cap C)$$ for $C$ in the sigma algebra generated by $X$. So, for $C=\{X\in B\}$,
$$\frac{\int_{\{X\in B\}} P(A|X)(\omega)dP(\omega)}{P(X\in B)}=P(A\mid X\in B).$$