Codimension of 'general' fibers Let $f: X \to Y$ be a smooth, dominant map between two smooth varieties $X$ and $Y$ (ie integral, separated $k$-schemes finite type). 
Question: what can I say in this context about codimension of a general fiber of $f$? (This question might be seen as a kind of 'degeneration' of this question.)
Now I want to explain what I mean by 'general', since I use 'general' here not in conventional sense, since this would lead me to certain problems which I would like to explain below. Here by general I mean that there exist an open subset $U \subset Y$ such that for all closed points $y \in U$ all fibers $X_y$ have the same codimension.
Recall the definition of codimension for general subsets $S \subset X$: $\operatorname{codim}(S,X)= \operatorname{codim}(\overline{S},X)$, since in general $S$ is not assumed to be closed. Additionally, by definition of codimension, $\operatorname{codim}(\overline{S},X)= \max_i(X_i,X)$ where the $S_i$ are irreducible components of $\overline{S}$. therefore, assume that the  fiber $X_{y}$ is irreducible. In general the codimension of a closed irreducible subset $A \subset X$ is defined as the maximal chain length $l$ of irreducible subsets $A = X_0 \subset X_1 \subset ... \subset X_l = X$.
First obvious consideration that can be done, is that since $f$ smooth, we know that the dimension of the fiber $\dim(X_y)= \operatorname{rank}_y(\Omega_{X/Y})= \dim(X)-\dim(Y)$. But as Aryan Javanpeykar pointed out in the linked thread on the example of generic fiber $X_{\eta}$, the naive 'dream' to say that $\operatorname{codim}(X_y)= \dim(X)-\dim(X_y)$ fails, since $X_{\eta}$ is dense in $X$. Although Aryan's example was given on generic point, ie not the closed one, I suppose that also for closed fiber $X_y$ one cannot expect $\operatorname{codim}(X_y)= \dim(X)-\dim(X_y)$. Please, correct me if I'm wrong. 
By the way this is exactly the point why I'm not talking about 'general fiber' in conventional way: a property of points of a space (scheme or module space or something else) is called general if there exist an open sets in the space such that all points of this set have this property. Since as demonstrated above the generic point is a 'bad guy' I can't expect to expect a statement about codimension of general fiber of $f$ in conventinal sense. Instead I'm asking if there exist an open subset $U \subset Y$ such that for all closed points $y \in U$ all fibers $X_y$ have the same codimension. 
 A: The right way to deal with the question you're asking is to work with the dimension of the fibers instead of the codimension of the fibers. Topologically, if there's an immersion $f:X\to Y$, the dimension of $f(X)$ is the same as the dimension of $X$, but the codimension of $f(X)$ has no relation to the dimension of $X$: consider $id:\Bbb A^n\to \Bbb A^n$. Then, topologically, every fiber is a point, but the codimension of these points in $\Bbb A^n$ ranges from $0$ to $n$ according to your definition.
If we do work with dimension, then the result is true - if $f:X\to Y$ is a finite type dominant morphism of integral schemes, then $\dim X_y$ is generically $\dim X - \dim Y$. We can easily see that this is true at the generic point by examining the extension of function fields: $Frac(Y)\subset Frac(X)$ is an extension of transcendence degree $\dim X - \dim Y$. Next, as for a finite type morphism $X\to S$, the set of points $$U_n : = \{x\in X\mid \dim_x X_{f(x)} \leq n\}$$ is open for every $n$, we get that $X\setminus U_{\dim X - \dim Y}$ is closed and does not intersect the generic fiber, so it's image is contained in some proper closed subset. By removing this from $Y$, we get the desired open subset where the dimension of the fiber is exactly $\dim X - \dim Y$. For full details, see Stacks section 05F6.
