I want to define precisely, exhaustively and constructively the conditional expectation of a random variable given the sigma algebra generated by a set. This question has some discussion on it but the definition is not made explicit.
Set Up
Let $(\Omega, \mathcal{F}, \mathbb{P})$ be a probability space, $(\mathsf{E}, \mathcal{E})$ be a measurable space (Banach space should be enough) and $X:\Omega\to\mathsf{E}$ be a random variable whose expectation exists and $\mathbb{E}[|X|] < \infty$. Let $\mathsf{A}\in\mathcal{F}$ be an event and define the sigma algebra generated by it as $$ \sigma(\mathsf{A}) := \{\emptyset, \Omega, \mathsf{A}, \mathsf{A}^c\}. $$ The conditional expectation $\mathbb{E}[X\mid \sigma(\mathsf{A})]:\Omega\to\mathsf{E}$ is a $\sigma(\mathsf{A})$-measurable random variable such that $$ \int_\mathsf{B} X(\omega) \mathbb{P}(d\omega) = \int_\mathsf{B}\mathbb{E}[X\mid \sigma(A)](\omega) \mathbb{P}(d\omega) \qquad\qquad\forall\, \mathsf{B}\in\{\emptyset, \Omega, \mathsf{A}, \mathsf{A}^c\}. \qquad\qquad (*) $$ I would like to construct this random variable. For instance, when $\mathsf{A} = \Omega$ and $\sigma(\mathsf{A}) = \{\emptyset, \Omega\}$ then it's easy to show that the constant random variable $Y(\omega) = \mathbb{E}[X]$ does the job. When $\mathsf{A}\neq \Omega$ things get a bit more complicated. We aim means that to find a version of $\mathbb{E}[X\mid \sigma(\mathsf{A})]$, that is a random variable $Y:\Omega\to\mathsf{E}$ that is $\sigma(\mathsf{A})$-measurable and satisfies $(*)$. I cannot show that either holds (constructively). Even simply showing measurability is tricky because I don't know how to construct this random variable.
Measurability
Most measure theory books define the conditional expectation $\mathbb{E}[X\mid \mathsf{A}]$ to be a number, typically $$ \mathbb{E}[X \mid \mathsf{A}] = \begin{cases} \displaystyle \frac{1}{\mathbb{P}(\mathsf{A})}\int_\mathsf{A} X(\omega) \mathbb{P}(d\omega) & \text{ if } \mathbb{P}(\mathsf{A}) > 0 \\ \text{any value in } \mathsf{E} & \text{ if } \mathbb{P}(\mathsf{A}) = 0. \end{cases} $$ My guess is that this number must appear somewhere in our definition of the random variable $Y(\omega) = \mathbb{E}[X\mid \sigma(\mathsf{A})](\omega)$. Recall that for $Y(\omega)$ to be $\sigma(\mathsf{A})$-measurable we require that for any $\mathsf{C}\in\mathcal{E}$ $$ Y^{-1}(\mathsf{C}) \in \{\emptyset, \Omega, \mathsf{A}, \mathsf{A}^c\}. $$ Now when $\mathbb{P}(\mathsf{A}) > 0$ then one has that $Y^{-1}(\mathsf{C})\in\sigma(\mathsf{A})$ because $$ Y^{-1}(\mathsf{C}) = \{\omega\in\Omega\,:\, \mathbb{E}[X\mid \mathsf{A}]\in\mathsf{C}\} = \begin{cases} \emptyset & \text{if } \mathbb{P}(\mathsf{A})^{-1}\mathbb{E}[X 1_\mathsf{A}]\in\mathsf{C}\\ \Omega & \text{if } \mathbb{P}(\mathsf{A})^{-1}\mathbb{E}[X 1_\mathsf{A}]\notin\mathsf{C}. \end{cases} $$ When $\mathbb{P}(\mathsf{A}) = 0$ things get more tricky. Ideally I would want that for any $\mathsf{C}\in\mathcal{E}$ we have that $Y^{-1}(\mathsf{C})$ is either $\mathsf{A}$ or $\mathsf{A}^c$. I cannot seem to find a way of defining $Y$ so that this is true.