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?