Let $X$ be a ‘definable’ Polish space (in the day-to-day, not necessarily the set-theoretic sense, though possible the latter generalises this). Consider a complexity class $\Gamma(X)$ of subsets of $X$, such as the open, closed, $\mathbf{\Pi}^{0}_{2}$, $\mathbf{\Sigma}^{1}_{1}$, measurable, meagre, etc. sets. Are there known results, which say $\Gamma(X)$ remains unchanged under forcing? In particular, I want to know if in general the class of $\mathbf{\Pi}^{0}_{2}$-subsets remains unchanged under forcing extensions.
EDIT. I apologise for the unclarity. There are indeed many versions of this question. What I concretely need is the following: Let $\mathbb{V}\models\mathrm{ZFC}$ and $\mathbb{V}[G]$ be a forcing extension. Let $X$ be parameter-definable in $\mathbb{V}$ say by $X=\{x\mid\phi(x,a)\}$ where $a\in\mathbb{V}$. Suppose $A\subseteq X$ is formula definable in $\mathbb{V}$ via $A=\{x\in X\mid \psi(x)^{X}\}$. And assume $\psi$ is of logical complexity $\Gamma$, so that $A\in\Gamma(X)$ (in $\mathbb{V}$). Now let $X':=\{x\in\mathbb{V}[G]\mid\mathbb{V}[G]\models\phi(x,a)\}$ and $A':=\{x\in X'\mid \psi(x)^{X'}\}$. Clearly, $A'\in\Gamma(X')$ in $\mathbb{V}[G]$. But could the complexity reduce? That is, if $\Gamma'\subset\Gamma$ is strictly, and $(A\notin\Gamma'(X))^{\mathbb{V}}$, could it hold that $(A'\in\Gamma'(X'))^{\mathbb{V}[G]}$? Concretely I'm concerned with the case of something like $\Gamma=\mathbf{\Pi}^{1}_{3}$ and $\Gamma'=\mathbf{\Pi}^{0}_{2}$.
EDIT: Again, let's take $X=\omega^\omega$ for simplicity.
You're basically asking whether - for example - a "${\bf \Pi^1_3}$-code" could describe a properly ${\bf \Pi^1_3}$ set in $V$ but a much simpler (say, ${\bf \Pi^0_2}$) set in $V[G]$.
The answer is yes. For a concrete example, the set $S$ of nonconstructible reals is "uniformly" ${\bf \Pi^1_2}$ ($x$ is nonconstructible if for every countable $\omega$-model of ZFC+V=L containing $x$, there is a descending sequence in the ordinals of that model). But its optimal complexity can vary wildly:
If $V=L$ then $S=\emptyset$ and hence is ${\bf \Delta^0_0}$. (Note that "$S=\emptyset$" is $\Pi^1_3$ and so Shoenfield absoluteness doesn't apply to it.)
If $\omega_1^L$ is countable, then $S$ is cocountable and hence ${\bf \Pi^0_2}$ - and since $S$ is codense, by the Baire category theorem it's not ${\bf \Sigma^0_2}$. Note that the ${\bf \Pi^0_2}$-code for $S$ in such a model will not itself be an element of $L$, so this doesn't contradict Shoenfield either.
And finally, if I recall correctly it's possible for $S$ to achieve the upper bound of "properly ${\bf \Pi^1_2}$," although this is harder to show (and I might be misremembering, I'm rather tired).
Going a bit further up, though, and being a bit less natural, we can get an easy-to-verify counterexample: consider $$\{x\in\omega^\omega:(\mathbb{R}^L=\mathbb{R})\wedge\psi(x)\},$$ where $\psi(x)$ is some formula which ZFC-provably defines a ${\bf \Pi^1_3}$-complete set. This set's obvious definition is $\Pi^1_3$ ("$\mathbb{R}^L=\mathbb{R}$" is already $\Pi^1_3$); however, in some models (namely, if $\mathbb{R}\not=\mathbb{R}^L$) it's empty and hence ${\bf \Delta^0_0}$ while in other models (namely, if $\mathbb{R}=\mathbb{R}^L$) it's ${\bf \Pi^1_3}$-complete. And this is at the specific level you ask about.
(Note that this specific trick won't work to get a $\Pi^1_2$ example - Shoenfield would prevent that.)
The problem is that the phrase
is very unclear. Remember that forcing - even very nice forcing - can change $X$ itself (e.g. Cohen forcing "adds points to $\mathbb{R}$").
The simplest nontrivial way to express your question, I think, is:
That is, we allow $\varphi$ to "gain points" since the underlying space itself gains points, but we require that $\varphi$ not "change its mind."
In this case, the usual absoluteness principles have something to say. For example, Shoenfield absoluteness - which is roughly the extent of absoluteness which ZFC alone provides us, but not the limit of possible absoluteness - tells us that the above equation holds whenever $\varphi$ is $\Pi^1_2$ with real parameters (or $\Sigma^1_2$ with real parameters). Additional set-theoretic assumptions get more absoluteness of course. And certainly this implies that $\Pi^0_2$ sets (or rather, $\Pi^0_2$ definitions - we're really looking at the precise definition, not just the bare set itself) have the "preservation" property above.
We can also ask when a formula retains a certain property, e.g.:
Again, the approach is basically syntactic: look at the complexity of $P$ and $\varphi$, and see whether the current set-theoretic axioms allow that sort of absoluteness. For a negative example, we can have an open set become properly $\Sigma^1_{17}$ in a generic extension: letting $\varphi(x)$ be the formula "either $\mathbb{R}^V=\mathbb{R}^L$ or $\psi(x)$," where $\psi$ is a ZFC-provably-$\Sigma^1_{17}$-complete formula, we get that $\varphi^L$ is open (namely, $\varphi^L=\mathbb{R}^L$) but $\varphi^{L[G]}$ is $\Sigma^1_{17}$-complete if $L[G]$ has a non-constructible real.
The issue here is that $\varphi$ is so complicated that the principle "$\varphi$ is open" is not susceptible to Shoenfield absoluteness. On the other hand, it is absolute provided we have enough large cardinals in the universe (and remember, to forestall worry, that enough large cardinals do prevent $V=L$). So the complexity of $\varphi$ itself, as well as the property $P$ in question, plays into the problem.
However, I'm not sure this is what you really want, since you seem to be talking about the class of sets itself being unchanged. In general this is something we can't ever hope for. For example, let $G\in 2^\omega$ be a Cohen real over $V$ and consider the set $$S_G=\{f\in\omega^\omega: f(1)=G(f(0))\}.$$ That is, an element $f$ of $S_G$ tells us one bit of $G$: look at the first coordinate of $f$ to determine what bit of $G$ the real $f$ is trying to tell us, and at the second coordinate of $f$ to determine what the value of that bit of $G$ is. The point is that even though $S_G$ is open we know that $S_G\cap V$ is not in $V$, since otherwise we could determine $G$ in $V$ (we'd have $G(n)=0\iff (n,0,0,0,...)\in S_G$); so I see no sense at all in which the class of opens of $V[G]$ is the same as the class of opens of $V[G]$.