Is it an abuse to refer to constant (or constant functions) as random variables? I am reading a lecture notes that makes the following assertion, which I quote in verbatim.

Let $s \in \{0,1\}$, then $s$ is a random variable. We assume that
$\Pr[s = 0] = 0.5$ and $\Pr[s = 1] = 0.5$.

Technically $s$ does take on the value of $0$, $1$ because it is $0$ or $1$. But to me this is not defined properly, because it does not mention anything about the sample space.
This is something that has kept confusing me because a random variable is a function, but in the case this function is a constant function (or takes on constant value), then difference between the function and the value that it takes on gets blurred.
To simply this question to its logical extreme, is the number $s = 1$ a random variable with $\Pr[s = 1] = 1$?
 A: Yes, this formulation is kind of loose.
What is meant is that for example you have $\Omega = \{w_1,w_2\}$ i.e. two possible outcomes, and then the outcomes $w_1, w_2$ both have probability $0.5$.
Then $s$ is just a function $\Omega \to \{0,1\}$ defined as $s(w_1) = 0, s(w_2) = 1$.
Therefore
$\Pr[s = 0] = 0.5$
$\Pr[s = 1] = 0.5$
Another (more general) setup is that you have some events $A$ and $A^c$,
$A \cup A^c = \Omega$, $A \cap A^c = \emptyset$
and also $\Pr[A] = \Pr[A^c] = 0.5$
In that setup it does not matter much what the exact $\Omega$ is,
we just need to be able to partition it into two non-empty sets.
Then $s$ is just a function $\Omega \to \{0,1\}$ defined as:
$s(w) = 1$ if $w \in A$ and $s(w) = 0$ otherwise.
A: What's going on in the example you quote is different from the constant-function issue. We don't actually mean that $s$ is either the constant function $0$ or the constant function $1$. We mean $s$ to be a proper random variable, we just haven't defined it fully.
Random variables without a sample space
Formally, a random variable needs a sample space to be defined: a random variable $\mathbf X$ is a function from the sample space $S$ to some set $R_{\mathbf X}$, the range of $\mathbf X$.
In practice, it's often true that whatever we want to know about $\mathbf X$ only depends on its distribution, and not on whatever is going on in the sample space. In the case of a discrete random variable, this means that once we specify $\Pr[\mathbf X = x]$ for every $x \in R_{\mathbf X}$, we know "everything we need to know" about $\mathbf X$, and don't need to say what $\mathbf X$ is as a function, or even what the sample space is.
If this makes you uncomfortable, you can always take the most boring random experiment that $\mathbf X$ could possibly live in. Let the sample space $S$ be $R_{\mathbf X}$ and define $\mathbf X$ to be the identity function; then, define $\Pr[A]$ for every event $A \subseteq S$ to be whatever you want $\Pr[\mathbf X \in A]$ to be.
In your example, we can define our sample space $S = \{0,1\}$, with $\Pr[\varnothing] = 0$, $\Pr[\{0\}] = \Pr[\{1\}] = 0.5$, and $\Pr[\{0,1\}] = 1$. Then, let $s$ be identity function on $\{0,1\}$. That's the random variable being described.
Of course, a random variable with the same distribution could be defined on other sample spaces. But if someone is talking about a random variable in this "sloppy" way, it's a good bet that this won't make a difference.
Random variables that are constant
Whichever approach we take to defining random variables, there's nothing wrong with a random variable $\mathbf X$ that's the constant function. For example, you could define the random variable $\mathbf 5$ as a function mapping everything in the sample space to $5$. Then the distribution of $\mathbf 5$ is that it's equal to $5$ with probability $1$.
We usually don't really care to do this for its own sake, but sometimes this happens accidentally. For example, the conditional expectation $\mathbb E[\mathbf X \mid \mathbf Y]$ is defined to be the random variable that's equal to $\mathbb E[\mathbf X \mid \mathbf Y=y]$ whenever $\mathbf Y=y$. If $\mathbf X$ and $\mathbf Y$ happen to be independent, then we've ended up defining a random variable that's always equal to the constant $\mathbb E[\mathbf X]$.
I'd rather distinguish the constant $5$ from the random variable $\mathbf 5$, but I can't think of a case in which it would matter.
