Extending a polynomial function from an open subset I am a bit embarrassed to ask this question, but still: assume that I have
a finite morphism $\pi:X\to Y$ of affine algebraic varieties over a field (probably
finiteness is too strong an assumption, but it is true in my situation, so let
me assume it), which is an isomorphism
over an open subset $U$ of $Y$. Let $Z$ be the complement of $U$. Assume that 
I am given a regular function $f$ on $X$ which vanishes on the scheme-theoretic preimage
$\pi^{-1}(Z)$ of $Z$. Does it come from a function on $Y$?
 A: I don't think so. Let $Y$ be the plane curve $y_1^2=y_2^5$, let $X$ be the line with coordinate $x$, and define $\pi:X\to Y$ by $y_1=x^5,y_2=x^2$. It's an isomorphism outside the closed point $y_1=0=y_2$. The function $x^3$ vanishes on the scheme-theoretic preimage (that is, it belongs to the ideal of $k[x]$ generated by $x^5$ and $x^2$), but it doesn't come from a function on $Y$ (that is, it is not in the subring of $k[x]$ generated by $x^5$ and $x^2$).
A: I was in fact pondering the same question just yesterday, and ended up with this: there is a thickening $Z'\subset X$ of $\pi^{-1}Z$ such that every regular function vanishing on $Z'$ comes from $Y$.
Proof is straight forward, but anyway: in terms of rings, let $\phi\colon A \subset B$ be a finite extension of rings, with $B$ generated by finitely many $x_i$ as an $A$-module, let $I\subset A$ be an ideal and suppose $A_f \cong B_f$ for all $f\in I$. Let $f\in I$. For each $i$ we can then write $\phi(a_i) = x_i \phi(f)^{n_i}$ for some $a_i\in A$. Choose $n > n_i$ for all $i$ and let $I'\subset A$ be generated by all $f^n$ for $f$ running through a generator set of $I$ (with $n$ varying with $f$). Now $I'B$ defines $Z'$: its elements are $A$-linear combinations of $\phi(f^n)x_i =\phi(f^{n-n_i})\phi(a_i)$, which is in $I$.
(Still interested if there is a better statement. Also I was still looking for an example where the thickening was needed, so thanks, Tom!)
