Differentiable manifolds as locally ringed spaces

Let $X$ be a differentiable manifold. Let $\mathcal{O}_X$ be the sheaf of $\mathcal{C}^\infty$ functions on $X$. Since every stalk of $\mathcal{O}_X$ is a local ring, $(X, \mathcal{O}_X)$ is a locally ringed space. Let $Y$ be another differentiable manifold. Let $f\colon X \rightarrow Y$ be a differentiable map. Let $U$ be an open subset of $Y$. For $h \in \Gamma(\mathcal{O}_Y, U)$, $h\circ f \in \Gamma(\mathcal{O}_X, f^{-1}(U))$. Hence we get an $\mathbb{R}$-morphism $\Gamma(\mathcal{O}_Y, U) \rightarrow \Gamma(\mathcal{O}_X, f^{-1}(U))$ of $\mathbb{R}$-algebras. Hence we get a morphism $f^{\#} \colon \mathcal{O}_Y \rightarrow f_*(\mathcal{O}_X)$ of sheaves of $\mathbb{R}$-algebras. It is easy to see that $(f, f^{\#})$ is a morphism of locally ringed spaces.

Conversely suppose $(f, \psi)\colon X \rightarrow Y$ is a morphism of locally ringed spaces, where $X$ and $Y$ are differentiable manifolds and $\psi\colon \mathcal{O}_Y \rightarrow f_*(\mathcal{O}_X)$is a morphism of sheaves of $\mathbb{R}$-algebras. Is $f$ a differentiable map and $\psi = f^{\#}$?

-
Yes. The point is that once you have a morphism of ringed spaces then you know that the map has an expression in local coordinates that is smooth/analytic/algebraic etc. as according to the nature of your structure sheaf. Brian Conrad has notes on the locally ringed space approach to differential geometry, if I recall correctly. –  Zhen Lin Oct 30 '12 at 22:08
The answer to your question is yes. Let $s:U\to \mathbb R$ be a smooth function. The equation $\psi s=f^\# s$ follows from the commutativity of the diagram below. Notice the triangle commutes because there is a unique $\mathbb R$-algebra map $C^\infty_{f(x)}/{\frak m}_{f(x)}\cong \mathbb R \to \mathbb R$. (Please let me know on the comments if the notation is not clear.) It is clear that $f:X\to Y$ is smooth if $s\circ f$ is smooth for all real valued functions $s$ on $Y$.