When I study formal completion and formal schemes, on p.194 of Hartshorne's "Algebraic Geometry", he said "One sees easily that the stalks of the sheaf $\mathcal{O}\_{\hat{X}}$ are local rings." 


Notice that here $\mathcal{O}\_{\hat{X}}$ is not the structure sheaf of X, there is a "hat" on the symbol $X$.


But I can't see the reason for that the stalks of the sheaf $\mathcal{O}\_{\hat{X}}$ are local rings.


Could someone explains this for me, thanks.



formal completion
Here is a self-contained explanation (hopefully without any blunder): 


Locally, $\hat{X}$ is an affine formal scheme, so each point has a neighbourhood basis admitting of open sets $U$ admitting the following description:
there is a ring
$A$, with ideal $I$, such that the underlying topological space is $U\_0 :=$ Spec $A/I$, and the structure sheaf is the projective limit of the sheaves $\mathcal O\_{U\_n},$
where $U\_n :=$ Spec $A/I^{n+1}$. 


(Note that the underlying topological space of all the $U\_n$ coincide, so as topological spaces $$U = U\_0 = \cdots = U\_n = \cdots .$$
The sheaves $\mathcal O\_{U\_n}$ are all sheaves on this same underlying topological space,
which form a projective system with obvious transition maps, corresponding to the surjections of rings $A/I^{n+1} \to A/I^n.$


Now if $x$ is a point of $\hat{X}$, and if we choose a neighbourhood $U$ of $x$ as above,
then the natural map on sheaves $\mathcal O\_{\hat{X}} \to \mathcal O\_{U\_0}$ induces
a natural map on stalks $\mathcal O\_{\hat{X},x} \to \mathcal O\_{U\_0,x}$.
The target is a local ring. Let $\mathfrak m\_x$ denote the preimage in $\mathcal O\_{\hat{X},x}$ of the maximal ideal
in $\mathcal O\_{U\_0,x}$; I claim that it is the unique maximal ideal of
$\mathcal O\_{\hat{X},x}$.


To see this, suppose that $f$ is an element of $\mathcal O\_{\hat{X},x}$ which does not
lie in $\mathfrak m\_x$. Then by definition of the stalk, $f$ extends to a section
of $\mathcal O\_{\hat{X}}$ over some neighbourhood of $x$, which (by shrinking $U$ as necessary) we may as well
assume is our affine neighbourhood $U$.
Thus we may think of $f$ as a section of the projective limit of $\mathcal O\_{U\_n}(U)$,
i.e. the projective limit of the rings $A/I^{n+1}$.


The assumption that $f$ is not in $\mathfrak m\_x$ says that its image in $\mathcal O\_{U\_0}(U)$ is not in the maximal ideal at $x$, and so shrinking $U$ further,
if necessary, we may assume that $f$ is a unit in $\mathcal O\_{U\_0}(U) = A/I$.


Thus $f$ is an element of the projective limit of $A/I^{n+1}$ which is a unit
in $A/I$. One easily verifies that $f$ is then a unit in every $A/I^{n+1}$,
and hence in the projective limit. Thus $f$ is a unit in the ring 
$\mathcal O\_{\hat{X}}(U)$, and so in particular in the stalk $\mathcal O\_{\hat{X},x}$.


I've shown that every element of the stalk $\mathcal O\_{\hat{X},x}$ not lying
in $\mathfrak m\_x$ is a unit, which implies that $\mathcal O\_{\hat{X},x}$ is local
with maximal ideal $\mathfrak m\_x$.


