Writing random variable formulas with set notations, What is the problem? Is it wrong to write $\displaystyle P(X \mid Y) = \frac{P(X \cap Y)}{P(Y)}$ when $X$ and $Y$ are random variables?
As I know a random variable is a function and therefore has a range and the two ranges may intersect.
 A: What you mean by, say, $P(X\vert Y)$, is unclear. In the well-known and accepted approach to probability theory, a probability space, $\left(\Omega,\Sigma, P\right)$, is defined and random variables $X, Y$ are defined on this probability space and required to be $\Sigma$-measurable. Measurability here means that any "nice" subset (for instance, Borel sets) of the range of each random variable has a pre-image in the shared domain, $\Omega$, of each random variable, where this pre-image is itself contained in the sigma-algebra $\Sigma$.
One reason why this construction of measurability is useful is because the probability measure $P$ is defined on subsets of the domain of the random variables. Measurability allows us to specify probabilistic events of interest in terms of the range of the random variables: this means that whenever we write statements using $P$ as defined above, $P$ must be operating on subsets of the domain, not the range of the random variables. So, for instance, $\left\{\omega\in\Omega:X{}={}x\right\}$ and $\left\{\omega\in\Omega:Y{}={}y\right\}$ would be two sets, in the shared domain, $\Omega$, of $X$ and $Y$, such that the probability of an outcome being contained in both sets is 
$$
P\left(\left\{\omega\in\Omega:X{}={}x\right\}\bigcap\left\{\omega\in\Omega:Y{}={}y\right\}\right){}={}P\left(\left\{\omega\in\Omega:X{}={}x\right\}\bigg\vert\left\{\omega\in\Omega:Y{}={}y\right\}\right)P\left(\left\{\omega\in\Omega:Y{}={}y\right\}\right)\,.
$$
The short-hand for this, bearing in mind its real meaning, is
$$
P\left(\left\{X{}={}x\right\}\bigcap\left\{Y{}={}y\right\}\right){}={}P\left(\left\{X{}={}x\right\}\bigg\vert\left\{Y{}={}y\right\}\right)P\left(\left\{Y{}={}y\right\}\right)\,,
$$
or, removing the set notation altogether,
$$
P\left(X{}={}x\,\,\bigcap\,\, Y{}={}y\right){}={}P\left(X{}={}x\bigg\vert Y{}={}y\right)P\left(Y{}={}y\right)\,.
$$
Personally, I would refrain from using notation such as $P(X)$; it is incorrect in the sense I have outlined because it does not specify well-defined events on which $P$ should operate. 
