In cryptography we consider random variables $K, M$ and $C$ over the key space $\mathcal K$ , message space $\mathcal M$ and cipher space $\mathcal C$, respectively.
I've studied discrete mathematics and, as far as I know, a random variable $X$ is a function from a sample space $\Omega$ to the real numbers $\mathbb R $.
How is it then possible to write $\text {Pr} [M = m]$ (as is done in many cryptography books), $m \in \mathcal M$ ?
I mean a random variable can never equal to object $m \in \mathcal M$ when its values are real numbers ?
Also, why are we allowed to call $K,M$ and $C$ random variables, when they doesn't satisfy the definition of a random variable ?
Hope someone can help a confused student.
Usually we consider real-valued random variables, but there's no problem at all in allowing $\mathcal M$-valued ones, especially if if $\mathcal M$ is a discrete space. We could, if we wanted to be pedantic, encode messages by real numbers.
EDIT: For a more general definition of random variables, see e.g. Wikipedia.