Global functions on arithmetic varieties Let $f:X\to\operatorname{Spec} O_K$ be an arithmetic variety  where $K$ is a number field and $O_K$ is its rings of integers. We assume that $X$ is integral, projective, regular and $f$ is flat.
If one looks at the analogy with algebraic varieties, it is reasonable to think that $H^0(X,\mathscr O_X)$ should be a finite ring extension of $O_K$. But, how can I prove that? Do you have a reference?
 A: If it’s just schemes we’re talking about:  let $X \subset P=\mathbb{P}^n_{O_K}$ be a closed immersion, $\mathscr{F}_0$ the direct image of $\mathcal{O}_X$, then $H^0(X,\mathcal{O}_X)=H^0(P,\mathscr{F}_0)$.
Let $F$ be a coherent module on $P$, there is an exact sequence $0 \rightarrow G \rightarrow L \rightarrow F \rightarrow 0$ of coherent modules with $L$ a finite sum of tensor powers of $\mathcal{O}_P(1)$. The cohomology long exact sequence and cohomology of tensor powers of $\mathcal{O}_P(1)$ (standard calculation) shows that for any $p \geq 0$, $H^p(P,F)$ is a finitely generated $O_K$-module iff $H^{p+1}(P,G)$ is one, too.
But standard arguments about Cech cohomology and cover size show that $H^l(P,K)=0$ if $l > n$ and $K$ is any quasi-coherent module on $P$.
It follows that $H^0(P,\mathcal{F}_0)$ is a finitely generated $O_K$-module, which is what you wanted to show (I think).
The argument is given with some more details in eg Chapter 5 of Qing Liu’s Algebraic Geometry and Arithmetic Curves, Hartshorne  III.5 and III.8, or Stacks, Lemmas 30.4.6 and 30.16.3.

This answer wouldn’t be complete if I didn’t mention the very important underlying theorem. In simplest terms, if $A$ is a Noetherian ring, $X$ is a proper $A$-scheme and $\mathscr{F}$ is a coherent module on $X$, then for any $p\geq 0$, $H^p(X,\mathscr{F})$ is a finitely generated $A$-module.
The sketch of argument above essentially shows that the statement holds if $X$ is projective over $A$. The general case follows, but the reduction is not easy (you can look at this thread if you’re interested).
