formal completion 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.
 A: 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$.
