How to classify the algebras C^∞(M)? This continues my question about smooth Gelfand-duality. In the book

Juan A. Navarro González & Juan B. Sancho de Salas, C∞-Differentiable Spaces, LNM 1824

it is shown that $M \mapsto C^\infty(M)$ is a fully faithfull contravariant functor from the category of manifolds (smooth, separable and without boundary) to the category of $\mathbb{R}$-algebras. Isn't this nice? It would be even more nice if there is an algebraic description of the essential image of this functor, so that we have an antiequivalence of categories between manifolds and certain $\mathbb{R}$-algebras. Thus my question is:


*

*Which $\mathbb{R}$-algebras $A$ are isomorphic to $C^{\infty}(M)$ for some manifold $M$?


Of course, you could just formulate that $Spec_r(A)=Hom(A,\mathbb{R})$ with the obvious structure sheaf is a manifold and that the canonical map $A \to C^{\infty}(M)$ is an isomorphism in terms of the ring structure of $A$. But this does not seem to be handy at all. I want some nontrivial purely algebraic formulation. If possible avoiding structure sheaves at all.
Here are some necessary conditions:


*

*If $f \neq g$ in $A$, then there is some $\mathbb{R}$-homomorphism $\phi : A \to \mathbb{R}$ such that $\phi(f) \neq \phi(g)$. In particular, $A$ is reduced.

*For every $p \in Spec_r(A)$ with corresponding maximal ideal $m_p$, then the maximal ideal $\overline{m_p}$ of $A_{\mathfrak{m}_p}$ is finitely generated, say by elements $f_1,...,f_n$, and the canonical map
$\mathbb{R}[t_1,...,t_n] / (t_1,...,t_n)^{r+1} \to A_{\mathfrak{m}_p} / \overline{m_p}^{r+1}, t_i \mapsto f_i$
is an isomorphism for all $r \geq 0$.

*With the notation above, the canonical map $A/m_p^{r+1} \to A_{\mathfrak{m}_p} / \overline{m_p}^{r+1}$ is an isomorphism.

*The function $Spec_r(A) \to \mathbb{N}, p \to \dim_\mathbb{R} \mathfrak{m}_p/{\mathfrak{m}_p}^2$ is locally constant.


Are they sufficient [no, see Michael's answer]? Finally [solved by Dmitri's answer]:


*

*How can we characterize the algebras (at least within all the $C^{\infty}(M)$'s), that come from compact manifolds?


You might admit that "$Spec_r(A)$ is compact with the Gelfand topolgy" is not a satisfactory answer ;-).
Addendum: At first glance, it appears too optimistic to find an algebraic characterization. But many famous problems started like that and involved unexpected methods. I don't claim that this applies to my problem. But at least I invite you to think about it. The properties of the algebras above are just an approximation. Even if we add some of the conditions in the answers (such as $\cap_{r} \overline{m}_p^{r+1} \neq 0$), it would be a great surprise that the conditions are sufficient. But I'm not convinced of the contrary as soon someone provides a counterexample. It is fun trying to deduce some of the differential geometric theorems such as IFT from the properties above (if $A \to B$ is an isomorphism in one tangent space, then it is a local isomorphism). Perhaps a first step is to characterize the local rings $C^{\infty}_p(\mathbb{R}^n)$.
 A: 
How can we characterize the algebras (at least within all the C^∞(M)'s), that come from compact manifolds?

An algebra of the form C^∞(M) corresponds to a compact manifold if and only if all of its maximal ideals have codimension 1.
If the manifold is non-compact, consider the ideal of all functions with compact support
and extend it to some maximal ideal using Zorn's Lemma.
Clearly, this ideal cannot correspond to any point of the manifold, hence its codimension must
be greater than 1.
To prove the converse, choose a maximal ideal I in C^∞(M) for some compact M.
Denote by A the set of all points x∈M such that all elements of I vanish at x.
A must be nonempty, because otherwise we can cover M by preimages of R \ {0} of functions in I,
choose a finite subcover of this open cover, and then observe
that the corresponding finite set of functions generates C^∞(M) as an ideal.
A cannot consist of more than one point, because otherwise I is not maximal.
For the same reason I consists of all functions that vanish at A, hence it has codimension 1.
A: This is to expand further on something I wrote in the comments.
Martin wrote:

Here are some necessary conditions: [...] Are they sufficient?

I think no since a polynomial algebra $\mathbb{R}[x_1,\ldots,x_n]$ satisfies all these conditions but is not isomorphic to the algebra of smooth functions on a manifold. A short explanation for this is that smooth functions satisfy Borel's lemma while polynomial algebras don't. Here's a more detailed explanation:
Let $m_p$ the maximal ideal corresponding to a point $p\in Spec_{\mathbb{R}}A$. Then for polynomial algebras as well as algebras of the form $C^\infty(M)$, the $m_p$-completion $\hat{A}=\lim_{r \geq 1} A/m_p^r$ is (after fixing local coordinates) a formal power series algebra $R[[x_1,\ldots,x_n]]$. The natural map $A\to \hat A$ may be interpreted as associating to a function its Taylor expansion at $p$. One version of the lemma of Borel says that for smooth function algebras this map is surjective. In other words: for every power series I give you (even non convergent) you can find a smooth function which has it as its Taylor series. Obviously this does not hold for polynomial algebras. So this gives you another necessary condition.
In the comments I said that polynomial algebras are finitely generated while algebras $C^\infty(M)$ are not. You asked me how to see this. I don't know if there is a simpler proof, but I would apply the same lemma of Borel: finitely generated algebras have a countable basis as vector spaces. But formal power series have no countable basis, and since the map $A\to \hat A$ is surjective also $A$ cannot have a countable basis.
(Obviously if you just wanted to know that polynomial algebras are not isomorphic to smooth function algebras you didn't need this anymore).
A: There is a strongly geometric characterization of those algebras which arise as $C^\infty(M)$ for $M$ compact and orientable, recently proved by Connes, see 
here. This has come up on MO before, e.g. in Joel Fine's answer to this question:
Algebraic description of compact smooth manifolds?
Like the proofs of most major theorems in differential topology, Connes's approach invokes (a) Riemannian metrics, and (b) hard analysis. Spectral geometry is not my area, so this will be an amateurish explanation... 
If $M$ is a compact smooth manifold, $C^\infty(M)$ is represented faithfully on the Hilbert space $H$ of $L^2$ sections of any hermitian vector bundle $S$. If $D$ is a first-order differential operator acting (unboundedly) on $H$ then we can recover the projective $C^\infty(M)$-module of sections $C^\infty(M;S)$ within $H$ as $\bigcap_{k>0}{dom(D^k)}$ (these domains will actually by Sobolev spaces, I believe). The algebraic counterpart of being first-order is that $[[D,f],g]=0$ for any $f,g \in C^\infty(M)$. 
$D$ has particularly nice properties when it's elliptic. There's no canonical elliptic operator over a smooth manifold until one chooses a Riemannian metric; there's then the signature operator $D=d+d^\ast$ acting on the complexified differential forms. This is an example of a Dirac operator (its square is a Laplacian -  this is a condition on the symbol of the operator). As such, it's formally self-adjoint, Fredholm, and its (real) spectrum has known growth rate depending on $\dim(M)$. 
Connes (see Theorem 11.4) shows that a commutative $\mathbb{R}$-algebra $A$ arises as $C^\infty(M)$ for a smooth manifold structure on the space $M$ Gelfand-dual to $A$ provided that it's part of a "spectral triple" $(A,H,D)$ of the right kind. This means that $A$ should act on a Hilbert space $H$ carrying an unbounded symmetric operator $D$ satisfying various properties. I've hinted at some of these; the most sophisticated property is an "orientation" condition invoking a Hochschild cycle $c\in Z_{\dim M}(A,A)$. This cycle is something like a volume form, and from its components Connes rebuilds local charts.
A: I think the appropriate category here is not that of algebras but algebras with derivations (linear maps satisfying Leibniz's product rule). If you don't look at the derivations you're forgetting the differentiable structure of the manifold and all the manifolds homeomorphic (possibly not diffeomorphic) to your manifold support your algebra of functions. I posted an answer along the same lines in your previous questions.
