Codimension of points in fibered products This is a question about a proof in Hartshorne, but let me try to formulate it without reference to Hartshorne.
Let $X$ be a noetherian scheme (which is also integral, separated and regular in codimension one, but I doubt these are important conditions). Let $x$ be a point in $X\times \mathbb A^1$ (fibered product) of codimension $1$. Let $\pi$ be the canonical projection $X\times \mathbb A^1 \to X$. Why does the point $\pi\left(x\right)\in X$ have codimension $\leq 1$ ?
This is tacitly used by Hartshorne in "Algebraic Geometry", proof of Proposition 6.6, Chapter II. (In Hartshorne's language, this is the claim that every point of $X\times \mathbb A^1 $ of codimension $1$ is either type 1 or type 2.)
I know that $\pi$ is surjective on the level of sets, but not sure whether this is enough. Maybe there is a nice definition of codimension that does not rely on irreducibility? (I feel that such a definition would make working with codimension easier.)
Generally, what kind of maps in algebraic geometry are known to not increase codimension of points? Is there some type of scheme maps (proper, finite, closed, etc.) that always has this property?
[Full disclosure: This is related to my homework (exercise 6.1 in Chapter II), where I have to do something similar for $X\times \mathbb P^1$; but I can reduce this to the $\mathbb A^1$ case and take the proof of Proposition 6.6 for granted. So you are not helping me cheat; you are preventing me from doing so.]
 A: Suppose that the codimension of $\pi(x)$ is at least two; then there exist a chain of closed irreducible subsets $V_0 \subset V_1 \subset V_2$ containing $\pi(x)$ (the inclusions are proper). The inverse image of this chain in $\mathbb A^1_X$ forms a chain of closed irreducible subsets of length 2, which implies that the codimension of $x$ is at least 2.
For the more general question, flat maps are good. You reduce to the affine case and apply the going-down theorem; see http://en.wikipedia.org/wiki/Going_up_and_going_down. There are several other cases in which this holds.
[Edit]: Question: why are the inverse images irreducible? Because the inverse image of $V \subseteq X$ in $\mathbb A^1_X$ is $\mathbb A^1_V$, and if $V$ is irreducible so is $\mathbb A^1_V$. This is a simple exercise, using two facts: the fibers of the projection $\mathbb A^1_V \to V$ are irreducible, and the projection $\mathbb A^1_V \to V$ is open. Now, let me anticipate the next question: why is the projection $\mathbb A^1_V \to V$ open? One can invoke fancy theorems, but it is easy to see. It's a local problem on $V$, so you may assume that $V$ is affine, say $V = \mathop{\rm Spec}R$. Let $U \subseteq \mathbb A^1_R$ be an open subset. Let $\{f_i\}$ be a bunch of polynomials in $R[x]$ whose zero locus is the complement of $U$ is $\mathbb A^1_R$. Then the image of $U$ is the complement of the closed subset of $V$ defined by the coefficients of the $f_i$.
