Sard's theorem for algebraic varieties

(One version of) Sard's theorem states that:

Theorem (Sard): Given $M$ and $N$ smooth manifolds of dimensions $m$ and $n$ respectively, and a smooth map $f:M\to N$, then the set of singular values of $f$ has measure zero.

A corollary of this is:

Corollary: If $m<n$, then there exists no smooth surjective map $f:M\to N$.

Now, I am quite certain that my proof of the following fact is correct:

Claim: Let $X$ and $Y$ be two quasi-projective, irreducible algebraic varieties (over an algebraically closed field $k$) of dimensions $m$ and $n$ respectively. If $m<n$, then there exists no smooth surjective map $f:X\to Y$.

Proof: Assume there was such a map $f:X\to Y$. Then it would induce an injective map $f^*:K(Y)\to K(X)$ between the fields of rational functions of the two varieties. We know that: $$\begin{array}{l}K(X)=k(x_1,\ldots,x_m)[u]\\K(Y)=k(y_1,\ldots,y_n)[v]\end{array}$$ where $k(x_1,\ldots,x_m)$ is a purely transcendental field extension of $k$, and $u$ is algebraic over $k(x_1,\ldots,x_m)$, and similarly for $K(Y)$. Consider the elements $f^*(y_i)\in K(X)$. They are transcendental over $k$, indeed if there was a polynomial $p\in k[z]$ with: $$0=p(f^*(y_i))=f^*(p(y_i))$$ then by injectivity of $f^*$ we would have $p(y_i)=0$, which is a contradiction. Similary, these elements are algebraically independent, since: $$0=p(f^*(y_1),\ldots,f^*(y_n))=f^*(p(y_1,\ldots,y_n))$$ would imply algebraical dependence of the $y_i$'s. So, the elements $f^*(y_i)$ form an algebraically independent set of transcendental element of cardinality $n$ in $K(X)$, which contradicts the assumption that $X$ had dimension $m<n$.


This last statement looks almost exactly the same as the previously stated corollary to Sard's theorem, so I was wondering: is there a version of Sard's theorem for algebraic varieties, or a similar result that would imply the claim above?


Since I promised to write an answer I'll put some things together.

To clarify a few things: Sard's theorem states that any surjective smooth (meaning $C^{\infty}$) map $f:X\to Y$ of smooth manifolds is generically a submersion (that is: generically on $X$ as well as on $Y$). Now in algebraic geometry the analogue to a submersion in differential topology is called a smooth morphism of relative dimension $\dim X-\dim Y$.

Let $X$, $Y$ be varieties over a field $k$. Then $f:X\to Y$ is called smooth, if the fibers are smooth varieties, and $f$ is flat (technical assumption). $f$ is called of relative dimension $n$, if the fibers are of dimension $n$.

Now if $f:X\to Y$ is a dominant morphism of varieties (possibly singular) over a field of characteristic $0$ (as Alex mentioned, you get counterexamples in char $p$), then there is an open and dense set $U \subset X$ such that $f$ is smooth on $U$, of relative dimension $\dim X-\dim Y$.

However, if you want generic smoothness of $f$ on $Y$, you need $X$ to be smooth. An easy counterexample for singular $X$ is the morphism $X\to Spec(k)$.

In a way, you could argue that these statements are better than Sard's theorem. You can see this if you look at the complex analytic case. You have the analoguous statement for $X$, $Y$ reduced complex analytic spaces, $f$ holmorphic. ($U$ will be open and dense in the analytic Zariski topology, which coincides with the algebraic Zariski topology if $X$, $Y$ are projective). Now say for simplicity $X$, $Y$ are complex manifolds.

You can apply the original Sard theorem to $f$, by looking at the underlying $C^{\infty}$-structure. So you know that the set of singular values has measure $0$. The above statement, however, gives you something better, namely that the set of critical values is the zero locus of some analytic functions.

Take, for instance, $f$ to be a nonconstant function of one complex variable. By the above the set of critical values and the set of critical points are analytic sets, and thus discrete (this can actually be proved in this case by an easy application of function theory in one variable). But there are measure $0$ sets, which are not discrete (for example the real line in $\mathbb{C}$).

As Alex mentioned, you'll find the algebraic results in Ravi Vakil's notes, which you can find online (they are called Foundations of Algebraic Geometry).

If you're also interested in the analytic case you'll find the results in "Several Complex Variables VII - Sheaf theoretic methods in complex analysis" by Grauert et. al.