Let $\mathbb{P}$ be the set of all perfect (i.e., every node has incomparable successors) subtrees of the full binary tree $2^{<\omega}$. We can endow $\mathbb{P}$ with a Borel structure by considering it as a subspace of $2^{2^{<\omega}}$ with the product topology.


If $p\in\mathbb{P}$, let $[p]$ denote the set of infinite branches through $p$, a nonempty perfect subset of $2^{\omega}$.


**Question**: Given a Borel subset $B\subseteq 2^\omega$, is the set $$S\_B=\{p\in\mathbb{P}:[p]\subseteq B\}$$ necessarily Borel?


Some observations:


* $S\_B$ is $\mathbf{\Pi}^1\_1$ (i.e., co-analytic), so this is equivalent to asking if $S\_B$ is also $\mathbf{\Sigma}^1\_1$ (i.e., analytic).
* If $B$ is open, then $S\_B$ is Borel: Let $\{t\_n:n\in\omega\}$ be finite binary strings such that $B$ is the union of the corresponding basic clopen sets $\mathcal{N}\_{t\_n}$. Then, $p\in\mathbb{P}$ if and only if every node in $p$ is comparable to some $t\_n$; this is a Borel condition. It is likewise easy to see that if $B$ is closed, then $S\_B$ is Borel.
* If you consider the collection $\{B\subseteq 2^\omega:S\_B\text{ is Borel}\}$, it contains the open sets (by the previous bullet) and it is closed under countable intersections, so it suffices to show that it is closed under complements.
* One strategy to find a counterexample might be to embed trees $T$ on $\omega$ into $2^{<\omega}$, via some nice map $f$, and find a Borel $B$ such that $T$ is well-founded if and only if $[f(T)]\in B$.



Set of perfect subsets of a Borel set
I believe that the answer is **no**, the set $S\_B$ need not be Borel.


Edit: I've incorporated some of François' suggestions from the comments, which should clean up the proof.


Consider the following embedding of $\omega^{<\omega}$ into $2^{<\omega}$: For the first level, send the node $(0)$ to $(0,0)$, and for $n>0$, send the node $(n)$ to $(\underbrace{1,\ldots, 1}\_{n\text{ times}},0,0)$. In general, having sent $s$ in $\omega^{<\omega}$ to $t$ in $2^{<\omega}$, send $s^{\frown}(0)$ to $t^{\frown}(0,0)$, and $s^{\frown}(n)$ to $t^{\frown}(\underbrace{1,\ldots, 1}\_{n\text{ times}},0,0)$.


Define a map $f$ from $\omega$-trees to perfect binary trees as follows: 


* First, assume that every node in $T$ either has a successor which is a leaf, or has incomparable successors. Map $T$ to the downwards closure (under initial segment) of its image under the above map, except that at each leaf node, append the sequence $(1,0,1)$, followed by a copy of $2^{<\omega}$.
* If $T$ has a node with no leaves or incomparable successors above it, replace it with $T'$, which is the downwards closure of $\{(t\_0+1,\ldots,t\_{k-1}+1,0):(t\_0,\ldots,t\_{k-1})\in T\}$. Then, $T'$ is as in the first case, and we let $f(T)$ be $f(T')$. Note that $T$ is well-founded if and only if $T'$ is, since a path through $T'$ can't have any $0$s.


This map is clearly Borel.


The image of a tree $T$ (in the first case above) under $f$ has the following property: each node in $T$ corresponds to a node in $f(T)$ ending in $(0,0)$ in $f$, and the **only** time an odd number of $0$s occurs in a row (with $1$s on either end) is after a leaf node.


Let $B\subseteq 2^\omega$ be the set of all binary strings which contain $(1,0,1)$ somewhere, or end in all $1$s. $B$ is $F\_\sigma$.


For an $\omega$-tree $T$, $T$ has an infinite branch if and only if $f(T)$ contains an element **not** in $B$. In other words, if $S\_B=\{p\in\mathbb{P}:[p]\subseteq B\}$, then $f(T)\in S\_B$ if and only if $T$ is well-founded. 


Thus, $S\_B$ is $\mathbf{\Pi}^1\_1$-complete, and in particular, not Borel.


