Complexity of the set of surjective continuous functions Let $X,Y$ be complete separable metric spaces, with $X$ locally compact, and $C(X,Y)$ the space of continuous functions from $X$ to $Y$, equipped with the topology of uniform convergence on compact sets.  If I am not  mistaken, $C(X,Y)$ is Polish.
Let $S \subset C(X,Y)$ be the set of functions in $C(X,Y)$ which are surjective.

Is $S$ Borel?  If not, what can we say about its complexity?

If $X$ is compact, it is easy to show that $S$ is closed.  But the locally compact case seems harder.
In particular, I have in mind something like $X = \mathbb{R} \times [0,1]^2$ and $Y = \mathbb{R}^d$.
Thanks!
 A: I have little intuition about the projective hierarchy, and this is presumably far too simple-minded to come close to a sharp estimate, but for what it's worth: the following easy argument shows that the set $S$ of surjective continuous functions  is at worst a $\boldsymbol{\Pi}_{2}^1$-set. I have no idea whether $S$ is Borel or not.
The point is that we can describe $S$ by quantifying twice over a Polish space: for all $y \in Y$ there exists $x \in X$ such that $f(x) = y$ or, equivalently, $(f,x,y) \in F$, where $F$ is the closed set
$$
F = \{(f,x,y) \in C(X,Y) \times X \times Y\,:\,f(x) = y\}
\subset C(X,Y) \times X \times Y.
$$
The set $F$ is closed because
the map $\operatorname{ev}\colon C(X,Y)\times X \to Y$ given by $\mathrm{ev}(f,x) = f(x)$ is continuous because $X$ is locally compact, and $F$ is the pre-image of the diagonal of $Y \times Y$ under $\mathrm{ev} \times \mathrm{id}_Y \colon C(X,Y) \times X \times Y \to Y \times Y$.
Projecting $F$ down to $C(X,Y) \times Y$ (existential quantification over $X$) gives us the $\boldsymbol{\Sigma}_{1}^1$-set (aka analytic set)
$$
A = \{(f,y) \in C(X,Y) \times Y\,:\,(\exists x \in X)\;f(x) = y\} \in \boldsymbol{\Sigma}_{1}^1.
$$
Now $\boldsymbol{\Sigma}_{1}^1 \subset \boldsymbol{\Pi}_{2}^1$ and the point class $\boldsymbol{\Pi}_{2}^1$ is stable under universal quantification over a Polish space (here $Y$) — see Kechris, Classical Descriptive Set Theory, Theorem 37.1 on page 314 but this is precisely the set we are interested in:
$$
\begin{align*}
  S &= \{f \in C(X,Y)\,:\,(\forall y \in Y)\;(f,y) \in A\} \\ & = \{f \in C(X,Y)\,:\,(\forall y \in Y)\,(\exists x \in X)\;(f,x,y) \in F\} \\
\end{align*}
$$
so we've shown that $S \in \boldsymbol{\Pi}_{2}^1$.
A: Thanks to a suggestion from Clinton Conley, we can show that this set is $\Pi_1^1$, i.e. co-analytic.
$X$ is $\sigma$-compact, so we can write $X = \bigcup K_n$ for compact $K_n$.  Then it is easy to check that
$$B_n := \{(f,y) \in C(X,Y) \times Y : y \notin f(K_n)\}$$
is open in $C(X,Y) \times Y$.  Thus $$B := \bigcap_n B_n = \{(f,y) \in C(X,Y) \times Y: y \notin f(X)\}$$
is $G_\delta$ and in particular Polish.  The projection of $B$ onto $C(X,Y)$ is thus analytic, but this projection is exactly the complement of $S$.
This leaves open the question of whether $S$ is necessarily Borel.  However, it does guarantee that $S$ is universally measurable.  Moreover, and this is what I really wanted, for any Polish $Z$ and any continuous $g : Z \to C(X,Y)$, $g^{-1}(S)$ is again $\Pi_1^1$ and hence universally measurable.
