Is restriction of a ring automorphism a subring automorphism? $\phi:R\to R$  is a ring automorphism.
$S \subset R$ is a subring and $\phi(S)\subseteq S$
Is $\phi|_S$ necessarily an automorphism of $S$ ?
I can easily check that $\phi|_S:S\to S$ is a homomorphism and injective, but is it necessarily surjective?
 A: No. Let $R$ be the polynomial ring in infinitely many variables $\{x_n\mid n\in\mathbb{Z}\}$, $S$ the polynomial subring with only the variables $\{x_n\mid n\in\mathbb{N}\}$, and the automorphism satisfying $\phi(x_n)=x_{n+1}$.
A: finitely generated example:
Let $R=k[x,y,1/y]$ and $f:(x,y)\mapsto (xy,y)$ and $S=k[x,y]$. Then, $f$ is well-defined on $S$ but not surjective.
A: A positive result:
If $S_1 = \cap_{i} \phi^i(S)$ then $\phi|_{S_1}$ is an automorphism. But i think for the example given in one of the answers, $\phi:=f:(x,y) \rightarrow (xy,y)$, we have that  $\cap_i f^i(k[x,y]) = k[y] = S_1$.
Anyone know any name for $S_1$ and when $S_1 = S$ ?
An example concrete positive result where $S_1 = S$:
Let $R$ be a PID. and $S = I = <r>$ and $r$ is prime.
Now we have, $\phi(I) = \phi(<r>) = <\phi(r)> \subseteq I = <r>$.
Automorphism maps prime element to a prime element (proof below).
Hence $\phi(r)$ is prime and $r$ is also prime. Hence $\phi(r) = ru$ for some unit $u$ or $\phi(r) \ | \ r$. Hence $<\phi(r)> = <r>$. Hence $\phi(I) = I$.
Automorphism maps prime element to a prime element: This is because, Let $p$ be a prime element and $\phi(p) \ | \  ab$ then $\phi(p) \ | \  \phi(\phi^{-1}(a) \phi^{-1}(b))$. Hence $\phi(p) q = \phi(p) \phi(q') = \phi(\phi^{-1}(a)) \phi(\phi^{-1}(b))$. Hence $pq' = \phi^{-1}(a) \phi^{-1}(b)$. Since $p$ is prime, say now, $p \ | \ \phi^{-1}(a)$. Hence $pw = \phi^{-1}(a)$. Hence $\phi(p) \phi(w) = a$. Hence $\phi(p) \ | \ a$. Hence $\phi(p)$ is prime.
