When is the set of measurable functions a vector space? I know this is not a research question, but I searched somewhat thoroughly and could not find the exact answer I want. But I've always wondered the following: suppose that $(X,\mathcal{M})$ is a measurable space and $Y$ is a real topological vector space equipped with the Borel $\sigma$-algebra $\mathcal{B}$. Let
$$L^0(X,Y):=\{f:X\to Y\;\mid\;f \text{ is measurable}\}.$$
When is $L^0(X,Y)$ a real vector subspace of $Y^X$? In other words, what are "minimal" assumption needed on $X$ and $Y$ so that measurable functions form a vector space?
Point 1: For example in the proof of the case when $Y=\mathbb{R}$, if $f,g$ are Borel measurable functions then we use the following equality
$$\{ f+g < b\} = \bigcup_{r\in\mathbb{Q}} 
    \{f< r\} \cap \{g< b-r\}.$$
to show that $f+g$ is measurable. So we have used the following assumptions

*

*$Y$ is ordered.

*$Y$ has a countable dense set w.r.t that order.

How much can this argument be generalized?
Point 2: When $Y$ is a Banach space, I know Bochner spaces come into play. Is there any result regarding the original question in this case?
 A: The usual thing to do, even when $Y$ is a Banach space, is to define "measurable" in such a way that it works.  (A while back I posted a counterexample to the general case.  See below.)
Bochner measurable, meaning there exist simple functions $f_n$ that converge a.e. to $f$.  "Simple" functions have finite range.   In case (i) $X$ is any measurable space and $Y$ is a separable Banach space or in case (ii) $X$ is a perfect measure space and $Y$ is any Banach space, then Bochner measurable is the same as $f$ is "measurable" from $\mathcal M$ to the Borel sets in $Y$.  But in general, Bochner measurability is the useful notion.
OR
(works for $Y$ a locally convex space) Weakly measurable, meaning $\phi \circ f$ is measurable for all continuous linear functionals $\phi : Y \to \mathbb R$.

The mentioned counterexammple, is part of my answer HERE
It provides two measurable functions $f,g : \Omega \to B$ with $f+g$ not measurable.
$\Omega = T \times T$ where $T$ has power $2^{\aleph_0}$ and and $\Omega$ has the product sigma-algebra $\mathcal F$, with $\mathcal P(T)$ in each factor.
$B = l^2(T)$, a non-separable Hilbert space with orthonormal basis $\{e_t: t \in T\}$.  We use the sigma-algebra $\mathcal B$ of Borel sets for the norm topology.
The definitions are $f\big((u,v)\big) = e_u$ and
$g\big((u,v)\big) = -e_v$.  Then $f,g$ are $\mathcal F$ to $\mathcal B$ measurable, but $f+g$ is not.  Details in the link.
