I've just started statistics (rather late) as the part of my course, I have done a little bit of logic where notion of variable is well defined.
Typically a 'variable' is treated just as a symbol usually one for which we look at different 'values' (assignments in the context of formal languages)
Sometimes 'random variables' are treated as if they work in a similar way, they are discussed as 'taking values' and sometimes we will discuss the probability of the random variable X taking a value that is an element of a set S as $P(X∈S)$ I could see this as for a symbol X the associated probability for the assignment that makes the fomula true.
This where I feel I am missing something, if $X$ is a function or mapping, then it would be $X$ at some value that is an element of S and not $X$ itself, if 'X' is a variable that varies over the values of a function and not denoting a function itself then that would be fine, but why are Random variables treated like this when defined as functions?