Let
$V = \{x \in \mathbb{P}^n |\forall i \in I, f_i(x) = 0, \exists j \in J,g_j(x) \ne 0\}$
and $W = \{y \in \mathbb{P}^m |\forall i \in I', f'_i(x) = 0, \exists j \in J', g'_j(x) \ne 0 \} $
be quasi-projective varieties over a global field $K$ and
$\phi: V \to W$ be a regular map defined over $K$.
We show that, for all but finitely many places $v$ of $K$,
$\phi(V(O_v)) \subset W(O_v)$.
Here, $O_v$ is the ring of integers of
the completion $K_v$ of $K$ at $v$ (assumed without loss of generality
to be non-archimedian),
$V(O_v) = \{x = (x_0:\ldots:x_n) \in V(K_v) | \forall i, x_i \in O_v,
\exists i, x_i \in O_v^*, \exists j \in J, g_j(x) \in O_v^*\}$,
and likewise for $W$.

We begin by covering $V$ by open subsets
$U_{\ell} =\{x \in V | r_{\ell}(x) \ne 0\}$ such that, on $U_{\ell}$,
$\phi(x) = (p_0^{(\ell)}(x):\ldots:p_m^{(\ell)}(x))$, where the $p_i^{(\ell)}$
are homogeneous polynomials with coefficients in $K$. The fact that the
$U_{\ell}$ cover $V$ means that whenever $x \in \mathbb{P}^n$ is such that
$f_i(x) = r_{\ell}(x) = 0 \forall i,\ell$, then we must have
$g_j(x) = 0$ for all $j$. Thus, by the
Nullstellensatz, $g_j^N = \sum u_{ij}f_i + \sum v_{\ell j}r_{\ell}$
for some polynomials $u_{ij},v_{\ell j}$ and integer $N >0$.

Now we use that, on $U_{\ell}$,
$\phi(x) = (p_0^{(\ell)}(x):\ldots:p_m^{(\ell)}(x)) \in W$, so
$g'_j(p_0^{\ell}(x):\ldots:p_m^{\ell}(x)) \ne 0$ for some $j \in J'$.
So, for any $x \in P^n$ satisfying
$f_i(x)=0, \forall i \in I,
g'_j(p_0^{(\ell)}(x),\ldots,p_m^{(\ell)}(x)) = 0 \forall j \in J'$
we must have $g_j(x)r_{\ell}(x) = 0$ for all $j \in J$.
Again, by the Nullstellensatz, for all $j \in J$
$(r_{\ell}g_j)^M = \sum z_{ij}^{(\ell)}f_i +
\sum_{j \in J'} w_j^{(\ell)}g'_j(p_0^{(\ell)},\ldots,
p_m^{(\ell)})$, for some polynomials $z_{ij}^{(\ell)},w_j^{(\ell)}$ and
integer $M > 0$.

We now take the finite set of places $S$ of $K$ including all archimedian
places and all places where some coefficient of one of the polynomials
considered above is non-integral. Let $v \notin S$ be a place of $K$.

Let $a \in V(O_v)$, then $g_j(a)^N = \sum v_{\ell}(a)r_{\ell}(a)$.
By assumption, for some $j$, $g_j(a)^N \in O_v^*$ and that implies that
$r_{\ell}(a) \in O_v^*$ for some $\ell$. Using these $j,\ell$, we get
$(r_{\ell}(a)g_j(a))^M \in O_v^*$ and therefore, for some $j\in J'$
$g'_j(p_0^{(\ell)}(a),\ldots,p_m^{(\ell)}(a)) \in O_v^*$.
This implies that $g'_j(\phi(a)) \in O_v^*$ for some $j$ and that
$p_i^{(\ell)}(a) \in O_v^*$ for some $i=0,\ldots,m$ and finally that
$\phi(a) \in W(O_v)$, as desired.

unique, so $V_S$ is "essentially unique" (up to increasing $S$). Given $V_S$ and $W_S$, show $f$ uniquely extends to $O_{K,S}$-map $V_S \rightarrow W_S$ after increasing $S$. $\endgroup$ – BCnrd Nov 24 '10 at 6:59