Let $A$ be a domain, not necessarily noetherian or normal, let $X = {\rm Spec}(A)$ and let $U\subseteq X$ be the complement of a prime divisor of $X$. Is it possible that $\mathcal O\_U(U) = \mathcal O\_X(X)$?



Complement of a divisor in an affine scheme
(Edited to add example) Yes, it may happen that $A=\mathcal{O}\_X(U)$: I will give an example at the end. On the other hand, this cannot happen if $A$ is noetherian. More generally:



> 
> **Proposition.** If $U$ is quasicompact, then $A\subsetneq\mathcal{O}\_X(U)$.
> 
> 
> 


Put $Y:= X\smallsetminus U$, and let $\mathfrak{p}$ be the corresponding prime ideal. The assumption on $U$ means, equivalently, that there is a *finitely generated* ideal $I$ of $A$ such that $\mathfrak{p}=\sqrt{I}$. 


To prove the proposition, observe first that it is clear if there is a *principal* $I=(t)$ as above. Indeed, in this case $t^{-1}\in \mathcal{O}\_X(U)\smallsetminus A$. In particular, it is true if $A$ is local with maximal ideal $\mathfrak{p}$: since $Y$ is a divisor and $A$ is a domain, we have $\mathfrak{p}=\sqrt{tA}$ for any nonzero $t\in \mathfrak{p}$.


For the general case, let $j:U\to X$ be the inclusion. Then $j$ is quasicompact and separated, which implies that $j\_\*$ preserves quasicoherence (EGA1, (6.7.1)) and commutes with flat base change for quasicoherent modules (EGA1, (9.3.2)). In particular $j\_\*\mathcal{O}\_U$ is quasicoherent, hence determined by its $A$-algebra of global sections $\mathcal{O}\_X(U)$. So it suffices to prove that $\mathcal{O}\_X\subsetneq j\_\*\mathcal{O}\_U$. By the flat base change to $X':=\mathrm{Spec\,}(A\_\mathfrak{p})$, the inclusion $\mathcal{O}\_X\subset j\_\*\mathcal{O}\_U$ is transformed into the similar inclusion $\mathcal{O}\_{X'}\subset j'\_\*\mathcal{O}\_{U'}$, which is not an isomorphism by the local case. QED 


**An example where $\mathcal{O}\_X(U)=A$.**


Take for instance $A=\overline{\mathbb{Z}}$, the ring of algebraic integers. This is a 1-dimensional domain. Every closed point $x\in\mathrm{Max}(A)$ corresponds to a (rank one) valuation $v\_x$ on $\overline{\mathbb{Q}}$, with valuation ring $\mathcal{O}\_{X,x}$. Fix one such point $y$ and take $U=X\smallsetminus\{y\}$. I claim that $\mathcal{O}\_X(U)=A$.


Indeed, take $z\in \mathcal{O}\_X(U)$. Then $v\_x(z)\geq0$ for each closed point $x\in\mathrm{Max}(A)\smallsetminus \{y\}$. We need to prove that $v\_y(z)\geq0$ as well. For this it suffices to prove that for each $t\in\overline{\mathbb{Q}}$ the "pole set" $\{x\in \mathrm{Max}(A)\mid v\_x(t)<0\}$ is either empty or infinite. Now, $t$ belongs to some number field $L\subset \overline{\mathbb{Q}}$, and the value of $v\_x(t)$ (suitably normalized) depends only on the restriction of $v\_x$ to $L$ (i.e. the image of $x$ in $\mathrm{Spec}(A\cap L)$). Since all the closed fibers of $\mathrm{Spec}(A)\to\mathrm{Spec}(A\cap L)$ are infinite sets, we are done.


