Projective subvarieties not contained at infinity I have an oddly specific question that hopefully someone can help me with. For some context, let $\mathbb{A}^n$ be the $n$-dimensional affine space over an algebraically closed field, and $\mathbb{P}^n$ the corresponding projective space. I'm trying to prove that if $X\subseteq\mathbb{A}^n$ is an algebraic set, $\overline{X}\subseteq\mathbb{P}^n$ (its projective closure, obtained by adding the points at infinity to $X$) has the same dimension as $X$, e.g. $\dim(X)=\dim(\overline{X})$. To do this I'm advised to do both inequalities, and to prove $\dim(X)\geq\dim(\overline{X})$ by induction in $\dim(\overline{X})$. My definition for dimension is the basic one, the longest chain of nonempty irreducible algebraic varieties $X_0\subsetneqq X_1 \subsetneqq ... \subsetneqq X_m\subseteq X$.
Now, the problem is the following. I've proven the base case, and now to complete the induction I need to prove that if it is true that when $\dim(\overline{X})=m$ we have $\dim(X)\geq\dim(\overline{X})$, then $\dim(\overline{X})=m+1$ implies also $\dim(X)\geq\dim(\overline{X})$. However if I consider an $m+1$-length chain of subvarieties of $\overline{X}$ (that exists because of the definition of dimension), maybe it could happen that these projective subvarieties are contained in the hyperplane at infinity, meaning that we cannot bring them into $\mathbb{A}^n$ and apply induction hypothesis on the $m$-dimensional subvariety.
As some advice I have been told that having every $m$-dimensional subvariety of $\overline{X}$ contained at infinity would lead to a contradiction, so we can pick one that has affine part and apply induction hypothesis. Even as I think it is true intuitively, I can't justify it properly.
Hints are appreciated, and please don't talk about more advanced things (sheaves, schemes, catenarity of polynomial rings over a field), because I need to work with basic stuff.
Thanks in advance
 A: Lemma: Let $d \geq 0$, let $H \subset \mathbb{A}^n$ be a hyerplane, and let $V \subset \mathbb{A}^n$ be a closed irreducible subset of dimension $d$ such that every proper closed irreducible subset of $V$ is contained $H$. Then $V \subset H$.
Proof: Let $R$ be the coordinate ring of $V$ (an integral domain), generated by $x_1,\ldots,x_n$. We know that $R$ has dimension $d$ and that every prime ideal $\mathfrak{p}$ of $R$ such that $R/\mathfrak{p}$ has dimension $d-1$ contains a fixed element $\ell = \sum_{i=1}^n{\alpha_i x_i}$ (corresponding to the equation of $H$), and $\ell$ is nonzero iff $V \subset H$.
Now, let $h \in R$ be non-invertible, and consider any minimal prime ideal $\mathfrak{p}$ containing $h$, then $R/\mathfrak{p}$ has dimension $d-1$ (Hauptidealsatz, I think?) so $(\ell,h) \subset \mathfrak{p}$. In particular, $1-R\ell$ is made with invertible elements, thus $\ell$ is in every maximal ideal so (Nullstellensatz) $\ell=0$, QED.

Now we show by induction over $d$ that any closed irreducible subset $V$ of dimension $d$ of $\mathbb{P}^n$ meeting $\mathbb{A}^n$ is the closure of $V \cap \mathbb{A}^n$ (this set is elementarily shown to be closed and irreducible) which has dimension $d$ (note that the first part is implied by the second part).
The case $d=0$ is obvious. Assume $d \geq 1$ and that the result is known up to $d-1$.
We choose an increasing sequence of nonempty closed irreducible subsets $F_0 \subset \ldots \subset F_d=V$ and let $i$ be the minimal index such that $V_i \cap \mathbb{A}^n \neq \emptyset$.
If $i < d$, we are done: by induction hypothesis $V_{d-1} \cap \mathbb{A}^n$ is closed irreducible with dimension $d-1$ so, as $V=V_d$ is irreducible, it is not contained in $H \cup V_{d-1}$ ($H$ is the hyperplane at infinity) so $V_d \cap \mathbb{A}^{n}$ has dimension more than $d-1$ so at least $d$, so exactly $d$. Moreover, the closure of $V \cap \mathbb{A}^n$ is a closed irreducible subset of $V$ of dimension at least $d$ (the dimension of $V$) so that $V \cap \mathbb{A}^n$ is dense.
If not, this means that every irreducible closed subset $W \subset V$ of dimension $d-1$ is contained in the hyperplane at infinity. Choose such a $W$, and choose a hyperplane $H'$ that does not contain $W$. Then we can still apply the same reasoning as the above for $W$ and $\mathbb{A}^n \cong \mathbb{P}^n \backslash H'$: then $W \backslash H'$ (resp. $V'=V \backslash H'$) are dense in $W$ (resp. $V$) and has dimension $d-1$ (resp. $d$).
Now, this $\mathbb{A}^n$ has a hyperplane given by $H_a=H \backslash H'$ and every closed irreducible subset of $V'$ of dimension $d-1$ has closure in $\mathbb{P}^n$ with dimension less than $d$ (because it can't be all of $V$ otherwise it would be dense in $V'$) and at least $d-1$, so that every closed irreducible subset of $V'$ of dimension $d-1$ is contained in $H \backslash H'$.
By the lemma, it follows $V' \subset H_a$ so that $V \subset H \cup H'$ hence $V \subset H$, a contradiction.

To conclude, apply the result to the closure of each irreducible component of $X$.
