Conditional Expectation: $E(X | \mathcal{G})$ is a function, while $EX$ is a constant?
Given are a probability space $(\Omega, \mathcal{F}_0, P)$, a $\sigma$-field $\mathcal{F} \subset \mathcal{F}_0$, and a random variable $X \in \mathcal{F}_0$ with $E \lvert X \rvert < \infty$. We define the conditional expectation of $X$ given $\mathcal{F}$. $E(X | \mathcal{F})$, to be any random variable $Y$ that has:
(i) $Y \in \mathcal{F}$, i.e. is $\mathcal{F}$ measurable.
(ii) for all $A \in \mathcal{F}$, $\int_A X \, dP = \int_A Y \, dP$
This is from the Durrett Probability textbook.
$EX$ and $E(X | \mathcal{F})$ are both expected values with similar notation, so I would expect them to have the same type. If I'm understanding this correctly, they do not.
$EX = \int_\Omega X \, dP$ is a number in $\mathbb{R}$. $E(X | \mathcal{F})$ is a random variable which is a function of type $\Omega \to \mathbb{R}$ like $X$. So $EX$ has a different type than $E(X | \mathcal{F})$. That makes sense, but seems incorrect.
Can someone explain this? Am I understanding this correctly? Is there a rationale behind this?
Your understanding is correct: $E(X \mid \mathcal{F})$ is a function $\Omega \to \mathbb{R}$.
What might help with your feeling that there is some "discrepancy" with $EX$ being a real number is the following.
When you plug in some $\omega \in \Omega$ into the function $E(X \mid \mathcal{F})$ you get a real number $E(X \mid \mathcal{F})(\omega)$. This may differ depending on which $\omega$ you plug in.
If you consider the special case where $\mathcal{F}$ is generated by some finite partition $\{B_1, \ldots, B_k\}$ of $\Omega$, then one can show that $E(X \mid \mathcal{F})(\omega) = E(X \mid \mathcal{F})(\omega')$ if $\omega, \omega' \in B_i$ for some $i$. So for this situation, the function $E(X \mid \mathcal{F})$ is constant on each $B_i$.
The expectation $E X$ can also be thought of as a conditional expectation $E(X \mid \mathcal{F}_0)$ with respect to the trivial $\sigma$-algebra $\mathcal{F}_0 = \{\varnothing, \Omega\}$. From my previous paragraph, note that this is also a function $\Omega \to \mathbb{R}$, but it is constant on all of $\Omega$. So, we usually just think of this as a real number rather than a function.