Can we recover a compact smooth manifold from its ring of smooth functions? It is well-known that if $X$ is a reasonably nice topological space (compact Hausdorff, say) then we can recover $X$ from the ring $C(X)$ of continuous functions $X\to\mathbb R$; see this MSE question for a discussion and problem 26 in the first chapter of Atiyah MacDonald for the construction. Is the same true for a compact smooth manifold $M$ and its ring $C^\infty(M)$ of smooth functions? More specifically,


*

*Let $M$ and $N$ be compact smooth manifolds. If $C^\infty(M)$ and $C^\infty(N)$ are isomorphic, then are $M$ and $N$ necessarily diffeomorphic?

*Can we recover the topological space $M$ from $C^\infty(M)$? If so, can we also recover the smooth structure on $M$?

 A: I want to give full steps to this problem. The answer is that one can recover $M$ from $\mathscr{C}^{\infty}(M)$ for  arbitrary manifold  $M$ (assuming second countability and Hausdorff). 


*

*First step, recover the space. Let 
$$\Sigma=\{\textrm{non-zero $\mathbb{R}$-algebra homomoprhoism $F:\mathscr{C}^{\infty}(M)\to \mathbb{R}$}\}$$
Actually, any $F\in \Sigma$ is a calculation, say $f\mapsto f(x)$ for some fixed $x$. 


Proof. Pick a "step" smooth function $f_0: M\to \mathbb{R}$ such that for any $\lambda\in \mathbb{R}$, $f_0^{-1}(\lambda)$ is compact (with using the assumption of existence of countable partition of unity). Assume $F$ is not a calculation, then
$$\forall x\in M, \exists f_x\in\mathscr{C}^{\infty}(M),\quad  \textrm{such that}\quad f_x(x)\neq F(f_x)$$
replace $f_x$ by $f_x-F(f_x)$, one can assume that $f_x(x)\neq 0$ and $Ff_x=0$. Then
$$U_x=\{a\in M: f_x(a)\neq 0\}\ni x$$
gives a open cover of $f_0^{-1}(F(f_0))$, thus there exists finite subset $X_0$ such that $\{U_x: x\in X_0\}$ cover $f_0^{-1}(F(f_0))$, construct
$$g=(f_0-Ff_0)^2+\sum_{x\in X_0} f_x^2\qquad Fg=0$$
but for any $y\in M$, $g(y)>0$. $\square$


*Second steo, recover the topology. Topologize $\Sigma$ with the weak topology such that for any $f\in \mathscr{C}^\infty(M)$, $F\mapsto F(f)$ is continuous. Then
$$\varphi: M\to \Sigma\qquad x\mapsto [f\mapsto f(x)]$$
is homoemorphism. 


Proof. Firstly, the map is surjective by above. By Urysohn's Lemma of smooth version, the map is injective. To show the map is continuous, it suffices to show $[F\mapsto F(f)]\circ \varphi=f$ is continuous, which is trivial. To show the map is closed map, for any closed $A$, by Urysohn Lemma of smooth version, there exists an $f:M\to \mathbb{R}$ such that $f^{-1}(0)=A$. This shows $\varphi(A)=[F\mapsto F(f)]^{-1}(A)$ is closed. $\square$


*Third step, recover its smooth structure 1. Now pick $p\in M=\Sigma$, One can defines a equivalent relation on $\mathscr{C}^{\infty}(M)$
$$f\sim g\iff f|_U=g|_U\textrm{ for some open neighborhood $U$ around $p$}$$
Then the corresponding quotient space is exactly the germ of $\mathscr{C}^{\infty}_p(M)$. 


Proof. Let $(f,U)$ be a representation of some germ at $x$, then by times a bump function, one can show that there exists some $g$ defining all over $M$ such $g|_V=f|_V$ for some more small neighborhood of $x$. $\square$


*Fourth step, recover its smooth structure 2. Now let 
$$\mathfrak{m}_p=\{f\in \mathscr{C}^{\infty}_p(M): f(p)=0\}$$
One knows that $\mathfrak{m}_p/\mathfrak{m}_{p}^2$ is exactly the cotangent space at $p$. Let $x^1,\ldots,x^n \in \mathscr{C}^{\infty}(M)$, such that their image in $\mathfrak{m}_p/\mathfrak{m}_{p}^2$ forms a basis. It must form a local coordination for $x$. 


Proof. That means $dx^1, \ldots, dx^n$ forms a basis of cotangent space at $x$. It must form a local coordination for $x$. It is a consequence of inverse maps theorem. $\square$
Once the local coordination is recovered, the proof is complete. 
A: As Eric Wofsey points out, because $M$ as a topological space is the space of homomorphisms $C^\infty(M) \to \Bbb R$, appropriately topologized, we know precisely what the elements of $C^\infty(M)$ are as functions on $M$. So we can recover the space $C^\infty(M)_p$ of germs at $p$, and hence we can recover the dimension of $M$ as the dimension of the space of derivations. Now we can pick a set of $n$ functions $M \to \Bbb R$ such that these functions induce an isomorphism $T_pM \to T_p \Bbb R^n$; restricting the functions to an appropriate subset of $M$, these are charts. So we can explicitly construct the charts from $C^\infty(M)$.
A deeply fancy way of explaining what's going on (even though you can do the above in all dimensions, and smoothing theory proper only in dimension $n \geq 5$) is smoothing theory. Smoothing theory equips a topological manifold $M$ with a "tangent microbundle", and if you can lift this microbundle structure to an honest vector bundle, this lift provides your manifold with a smooth structure. The point of the above is that, through $C^\infty(M)$ alone, we can construct the tangent bundle $TM$, and hence invoke smoothing theory.
A: What I'll describe next comes from the paper 

Ordinary differential equations on vector bundles and chronological calculus (R. V. Gamrelidze, A. A. Agrachev and S. A. Vakhrameev).

In the following $M$ must be second countable (it doesn't have to be compact). For a point $p\in M$ consider the map $\mathsf{ev}_p: C^\infty(M)\longrightarrow \mathbb R$ given by:
$$\mathsf{ev}_p(f):=f(p).$$
It is clearly an $\mathbb R$-algebra morphism. 

Theorem 1. There exists a bijection: 
$$M\longrightarrow \mathsf{Hom}_{\mathsf{Rng}}(C^\infty(M), \mathbb
 R)-\{0\},$$
which is given by:
$$p\longmapsto \mathsf{ev}_p.$$

The proof can be found in the forementioned paper. However, using this we can characterize easily the smooth functions on $M$.

Theorem 2. There exists a bijection:
$$C^\infty(M, N)\longrightarrow
 \mathsf{Hom}_{\mathsf{Alg}}(C^\infty(N), C^\infty(M))$$
which is given by:
$$f\longmapsto (f^*: C^\infty(N)\longrightarrow C^\infty(M),
 g\longmapsto g\circ f),$$
  which preserves composition.

It is easy to see this map is well defined (that is, $f^*$ is a homomorphism of $\mathbb R$-algebras). On the other hand, given $g\in \mathsf{Hom}_{\mathsf{Alg}}(C^\infty(N), C^\infty(M))$ define:
$$f(p):=q\quad (p\in M),$$
where $q\in N$ is the unique point such that:
$$\mathsf{ev}_p\circ g=\mathsf{ev}_q.$$
Such point $q$ exists by Theorem 1. applied to the nonzero ring homomorphism $$\mathsf{ev}_p\circ g:C^\infty(M)\longrightarrow \mathbb R.$$ 
The smoothness of $f$ follows from the following criterium:
$$f\in C^\infty(M, N)\Leftrightarrow h\circ f\in C^\infty(M)\ \forall h\in C^\infty(N).$$
In fact:
$$f^*(h)(p)=h(f(p))=h(q)=\mathsf{ev}_q(h)=\mathsf{ev}_p\circ g(h)=g(h)(p),$$ for every $h\in C^\infty(N)$ and for every $p\in M$, that is $$f\circ h=g(h)\in C^\infty(M)\ \forall h\in C^\infty(N),$$ and we are done. The above computation also shows that $f^*=g$.
Now using the above you can show easily $f$ is a diffeomorphism if and only if $f^*$ is an isomorphism of algebras.
I believe the above constructions gives an equivalence (maybe an isomorphism) of categories between the category of second countable manifolds $\mathsf{Man}$ and the category $\mathsf{Alg}_{\mathbb R}$ of $\mathbb R$-algebras. Just check how the categories $\mathsf{Man}$ and $\mathsf{Alg}_{\mathbb R}$ are defined in order to this equivalence to hold. 
A: [I assume all "smooth manifolds" are Hausdorff and paracompact.]
Yes, you can recover $M$ as a smooth manifold from the ring $C^\infty(M)$.  Here's a quick sketch.
First, note that we can recover the set of connected components of $M$, since each connected component $N\subseteq M$ corresponds to a minimal nonzero idempotent in $C^\infty(M)$, and the ideal generated by such an idempotent is isomorphic as a rng to $C^\infty(N)$.  Thus we can recover each of the rings $C^\infty(N)$ from $C^\infty(M)$, so we may assume without loss of generality that $M$ is connected.
Now note that every ring-homomorphism $\varphi:C^\infty(M)\to\mathbb{R}$ is evaluation at a point of $M$, which lets us recover the set of points of $M$ from $C^\infty(M)$.  For details, see the answers to this question.
So we've recovered the set $M$, and we also know how to think of elements of $C^\infty(M)$ as functions $M\to\mathbb{R}$ (since we identify points of $M$ with their evaluation homomorphisms). We can now also recover the smooth structure: we know exactly which functions $M\to\mathbb{R}$ are smooth, so we also know exactly which functions $M\to\mathbb{R}^n$ are smooth.  Since every connected manifold $N$ embeds in $\mathbb{R}^n$ for some $n$, we also know exactly which functions $M\to N$ are smooth for any such $N$.  This means we have recovered the entire functor $\operatorname{Hom}(M,-)$ on the category of connected smooth manifolds.  By Yoneda, this is enough to recover $M$.
A: I believe this is proven in Chapter 7 of Nestruev's Smooth Manifolds and Observables, but I haven't checked carefully. More precisely, the functor $M \to C^{\infty}(M)$ from smooth manifolds to the opposite of real commutative algebras is fully faithful, meaning that smooth maps $M \to N$ are precisely algebra maps $C^{\infty}(N) \to C^{\infty}(M)$. 
