This is a two part question. I apologize if the title and tags are vague. Please edit if a more suitable title or tags are appropriate.
Part 1
Ok, so if $X$ and $Y$ are independent, continuous random variables with range $\mathbb{R}$, then we can write (assuming pdfs exist):
\begin{align*} P(Y \gt X) &= \int_{\{(x,y) \in \mathbb{R}^2 : \; y \gt x\}} p_{X,Y}(x,y) \; dx dy \\ &= \int_{-\infty}^{\infty} \int_{-\infty}^y p_X(x)p_Y(y) \; dx dy \\ &= \int_{-\infty}^{\infty} P_X(X \leq y) \; p_Y(y) \; dy \\ &= E_Y[P(X \lt Y|Y)] \end{align*}
Is the last step valid, and how would one read this out loud / explain it intuitively?
Part 2
Next, take $Y$ to be Bernoulli with range $\{0, 1\}$ and $X$ with the same range as before. However, $X$ and $Y$ are now not independent. I want to consider the distributions, $X|Y=0$ and $X|Y=1$, and proceed like the previous case with $X|Y=0$ taking the place of $X$ and $X|Y=1$ taking the place of $Y$, but I'm kind of lost in notation and understanding.
- How do we write that $X|Y=1$ is independent of $X|Y=0$? What is the notation for the joint distribution?
- Does it even make sense that $X|Y=1$ and $X|Y=0$ could be independent? In words, it seems like it's feasible: the distribution of the value of $X$ given that $Y=1$ might not tell you anything about the distribution of the value of $X$ given that $Y=0$.
- $P(X|Y=1 \gt X|Y=0)$ seems horribly confusing. What is the notation for this?
Edit: update for Part 2
What I wrote for part was gibberish. So let me update with what my intentions were.
Consider four random variables: $X_1,X_2,Y_1,Y_2$. The ranges of $X_1$ and $X_2$ are both $\mathbb{R}$, while the ranges of $Y_1$ and $Y_2$ are both $\{0,1\}$. Similar to Part 1, I am interested in computing:
$$ P(X_1 > X_2 | Y_1=1,Y_2=0) $$
I was curious what assumptions on the $X_1,X_2,Y_1,Y_2$ allow for a similar calculation. It turns out that we must have both that $(X_1,Y_1)$ is independent of $(X_2,Y_2)$ and $Y_1$ is independent of $Y_2$. Under these assumptions,
$$ P(X_1 > X_2 | Y_1=1,Y_2=0) = \int_{\mathbb{R}} P(X_2 \lt x_1 | Y_2=0) p(x_1|Y_1=1) dx_1 $$