Let $\pi:X\to \mathbb{P}^1\_{\mathbb{Z}}$ be a proper flat morphism with $X$ an integral scheme. Is $\pi\_\*\mathcal{O}\_X$ necessarily locally free?



Proper and flat over $\mathbb{P}^1_{\mathbb{Z}}$ implies locally free
Like your [other question](https://mathoverflow.net/q/362600/82179), the answer to this one is related to miracle flatness:


**Theorem** (Miracle flatness). *Let $f \colon X \to Y$ be a finite dominant morphism of schemes with $Y$ regular. Then $f$ is flat if and only if $X$ is Cohen–Macaulay.*


See for example Tags [00R4](https://stacks.math.columbia.edu/tag/00R4) and [00R5](https://stacks.math.columbia.edu/tag/00R5).


Now let $f \colon X \to Y$ be flat and proper, with $Y$ regular of dimension $2$. Let $X \to Y' \to Y$ be the Stein factorisation, so $Y'$ is the normalisation of $Y$ in $X$ (see Tag [03H0](https://stacks.math.columbia.edu/tag/03H0)). Here is a positive result:


**Claim.** If $X$ is normal, then $f\_\* \mathcal O\_X$ is locally free.


Indeed, if $X$ is normal, then so is $Y'$, hence it is $S\_2$ by Serre's criterion (Tag [031S](https://stacks.math.columbia.edu/tag/031S)). Since it is finite (dominant) over $Y$, it has dimension $2$, so $S\_2$ is equivalent to Cohen–Macaulay. Then miracle flatness says that $Y' \to X$ is flat. $\square$


Conversely, if we assume a priori that $f$ is finite, then $X = Y'$, which is $S\_2$ if and only if it is Cohen–Macaulay if and only if it is flat over $Y$. So it suffices to construct a finite map $X \to \mathbf P^1\_{\mathbf Z}$ with $X$ not $S\_2$.


There are many ways to do this. One construction is to take a double cover $\mathbf P^1\_{\mathbf Z} \to \mathbf P^1\_{\mathbf Z}$ by $[x:y] \mapsto [x^2:y^2]$, and glueing together the points $[1:0]$ and $[-1:0]$ in the fibre above $3 \in \operatorname{Spec} \mathbf Z$ of the source $\mathbf P^1\_{\mathbf Z}$ (which map to the same point in the target). The resulting scheme is regular in codimension $1$ but not normal, so cannot be $S\_2$. (See also [this answer](https://mathoverflow.net/a/109486/82179) for glueing schemes along closed subschemes.)


