For a smooth variety $X$ over $\mathbb{Q}_p$. is there always a scheme $Y$ over $\mathbb{Z}_p$ satisfying conditions (1) $Y \otimes_{\mathbb{Z}_p}\mathbb{Q}_p\simeq X$ (2) $Y$ is flat over $\mathbb{Z}_p$ and regular (3) the morphism $Y\to \text{Spec}~\mathbb{Z}_p$ is subjective ?

## 2 Answers

Yes, this follows from Nagata's compactification theorem in this generality as follows. If we consider the morphism $X \to \operatorname{Spec} \mathbb{Z}_p$, there exists a proper scheme $\overline{Y} \to \operatorname{Spec} \mathbb{Z}_p$ and an open immersion $X \subset \overline{Y}$ over $ \operatorname{Spec} \mathbb{Z}_p$. When $X$ is quasi-projective, we can just take $\overline{Y}$ to be the closure inside $\mathbb{P}^n_{\mathbb{Z}_p}$. Up to replacing $\overline{Y}$ by its normalization, we can suppose that it is normal and thus regular in codimension $1$. Up to replacing $\overline{Y}$ with the closure of $X$, we can suppose that $X$ is a dense open. Thus $\overline{Y} \to \operatorname{Spec} \mathbb{Z}_p$ is proper, every component of $\overline{Y}$ dominates $\operatorname{Spec} \mathbb{Z}_p$ and $\overline{Y}$ is reduced so we conclude that $\overline{Y} \to \operatorname{Spec} \mathbb{Z}_p$ is flat and proper and in particular surjective.

By regularity in codimension $1$, we have a maximal open subset $U \subset \overline{Y}$ whose complement has codimension $2$ such that $U$ is regular and flat over $\mathbb{Z}_p$. By flatness, the fiber $\overline{Y}|_0$ over the closed point has codimension $1$ so $U \cap \overline{Y}|_0 \neq \emptyset$ and $U \to \operatorname{Spec} \mathbb{Z}_p$ is surjective. Since $X$ is smooth, $X \subset U$. Let $Z = U_{\eta} \setminus X$ where $U_\eta$ is the generic fiber of $U$ and let $\overline{Z}$ be the closure of $Z$ in $U$. Finally, let $Y = U \setminus \overline{Z}$. Then $Y$ does the job.

This is really a comment on Dori Bejleri's perfectly valid answer, to show how to bypass Nagata compactification.

Pick a nonempty affine open $U\subset X$. Then $U$ is the generic fiber of some affine $V$, surjective and flat over $\mathbb{Z}_p$ (this is easy). We may assume $V$ normal, and then observe (as Dori does) that the regular locus $W$ of $V$ is surjective over $\mathrm{Spec}(\mathbb{Z}_p)$, and has $U$ as generic fiber. Since $U$ is open in both $X$ and $W$, we can glue $X$ and $W$ along $U$ to get a scheme $Y$ as desired. Note that by construction, the closed fibers of $W$ and $Y$ coincide.

I suspect that the OP has omitted the (reasonable) requirement that $Y$ be separated. Let me show that the above $Y$ is (equivalently, that $Y\to\mathrm{Spec}(\mathbb{Z}_p)$ is a separated morphism) , using the valuative criterion. So let $S\to\mathrm{Spec}(\mathbb{Z}_p)$ be the spectrum of a valuation ring, with generic point $\eta$ and closed point $s$. Let $\alpha, \beta:S\rightrightarrows Y$ be two $\mathbb{Z}_p$-morphisms with the same restriction to $\eta$. Now we have two cases:

- either $S$ sits above $\mathrm{Spec}(\mathbb{Q}_p)$ and then $\alpha$ and $\beta$ factor through $U$ which is separated, hence $\alpha=\beta$;
- or $s$ is above $\mathrm{Spec}(\mathbb{F}_p)$, and then $\alpha(s)$ and $\beta(s)$ are in the closed fiber of $Y$, wich is contained in $W$. This means that $\alpha$ and $\beta$ factor through $W$, because $S$ is local, and we conclude again that $\alpha=\beta$ because $W$ is separated.