Maps $\phi:C^{\infty}(Y) \rightarrow C^{\infty}(X)$ as pullbacks I've just begun reading through Joyce's D-manifolds and d-orbifolds: a theory of derived differential geometry, and I've come across a seemingly innocuous statement that isn't quite clear to me.  Specifically, in $\S$1.2 he gives the following definition (in my words):

A $\mathbf{C^{\infty}}$-ring is a pair $(\mathfrak{C},\{\Phi_n\}_{n\geq 0})$ where $\mathfrak{C}$ is a set and $\Phi_n:C^{\infty}(\mathbb{R}^n)\rightarrow \text{Maps}(\mathfrak{C}^n,\mathfrak{C})$ satisfies (I will drop the subscript $n$, as no confusion should arise):
(i)  For any $m,n\geq 0$, $\ f_1,\cdots,f_m\in C^{\infty}(\mathbb{R}^n)$, and $g\in C^{\infty}(\mathbb{R}^m)$, we can define $h\in C^{\infty}(\mathbb{R}^n)$ by
$$ h(x_1,\cdots,x_n)=g(f_1(x_1,\cdots,x_n),\cdots,f_m(x_1,\cdots,x_n)). $$
Then for any $c_1,\cdots,c_n\in\mathfrak{C}$, $\Phi$ must satisfy
$$ \Phi_h(c_1,\cdots,c_n)=\Phi_g(\Phi_{f_1}(c_1,\cdots,c_n),\cdots,\Phi_{f_m}(c_1,\cdots,c_n)). $$
(ii)  For all $1\leq j\leq n$, the canonical projection maps $\pi_j:\mathbb{R}^n\rightarrow\mathbb{R}$ must satisfy
$$ \Phi_{\pi_j}(c_1,\cdots,c_n)=c_j $$
for all $c_1,\cdots,c_n\in\mathfrak{C}$.

Then there is a straightforward notion of a morphism between these structures:

A morphism between $C^{\infty}$-rings $(\mathfrak{C},\Phi)$ and $(\mathfrak{D},\Psi)$ is a map $\phi:\mathfrak{C}\rightarrow\mathfrak{D}$ such that
$$ \begin{array}{ccc} \mathfrak{C}^n & \xrightarrow{\Phi_f} & \mathfrak{C} \\ \downarrow^{\phi^n} & & \downarrow^{\phi} \\ \mathfrak{D}^n & \xrightarrow{\Psi_f} & \mathfrak{D} \end{array}$$
commutes for all $f\in C^{\infty}(\mathbb{R}^n)$ and $n\geq 0$.

The basic example, as hinted at by the name of these objects, is $C^{\infty}(X)$ where $X$ is a smooth manifold.  By defining
$$ [\Phi_f(c_1,\cdots,c_n)](x)=f(c_1(x),\cdots,c_n(x)) $$
for $f\in C^{\infty}(\mathbb{R}^n)$, $c_1,\cdots,c_n\in C^{\infty}(X)$, and $n\geq 0$, one clearly gets the structure of a $C^{\infty}$-ring.  Moreover, for a smooth map $f:X\rightarrow Y$, the pullback $f^{\ast}:C^{\infty}(Y)\rightarrow C^{\infty}(X)$ is clearly a morphism of $C^{\infty}$-rings.  But then Joyce goes on to say,
Furthermore (at least for $Y$ without boundary), every $C^{\infty}$-ring morphism $\phi:C^{\infty}(Y)\rightarrow C^{\infty}(X)$ is of the form $\phi=f^{\ast}$ for a unique smooth map $f:X\rightarrow Y$.

My question(s):  Why is this true?  How is the map $f$ constructed?  What about the construction fails if $Y$ has boundary?  Is this statement true regardless of whether or not $\phi$ is a $C^{\infty}$-ring morphism?

The thing that came immediately to mind was defining $f:X\rightarrow Y$ by
$$ f(x) = g^{-1}(\phi(g)(x)), $$
so that $f^{\ast}(g)=g(g^{-1}(\phi(g)))=\phi(g)$, but of course this only works if $g$ is surjective, and the equation $\phi=f^{\ast}$ only holds for this specific $g$.  I cannot, however, think of any other way of finding $f$… any suggestions?  References?
 A: Having finally had a little more time to return to this question, I searched around a bit more and found that this result is given by the following Proposition from Joyce's Algebraic Geometry over $C^{\infty}$-rings:

Proposition 3.3.  Let $X,Y$ be manifolds with corners.  Then the map $f\mapsto f^{\ast}$ from weakly smooth maps $f:X\rightarrow Y$ to morphisms of $C^{\infty}$-rings $\phi:C^{\infty}(Y)\rightarrow C^{\infty}(X)$ is a 1-1 correspondence.

Here, $f:X\rightarrow Y$ is weakly smooth if it is continuous, and for any charts $(U,\phi)$ and $(V,\psi)$ on $X$ and $Y$, respectively, then the map
$$ \psi^{-1}\circ f\circ\phi:(f\circ\phi)^{-1}(\psi(V))\rightarrow V $$
is smooth as a map between euclidean spaces.  Then one can define a notion of smoothness for maps between manifolds with corners as follows (from Joyce's On manifolds with corners, $\S$3):

Suppose $x\in X$ with $f(x)=y\in Y$ , and $\beta$ is a local boundary component of $Y$ at $y$.  Let $(V,b)$ be a boundary defining function for $Y$ at $(y,\beta)$.  Then $f^{-1}(V)$ is an open neighborhood of $x$ in $X$, and $b\circ f : f^{−1}(V)\rightarrow [0,\infty)$ is a weakly smooth map.  We require that either $b\circ f\equiv 0$ on an open neighbourhood of $x$ in $f^{−1}(V)$, or $(f^{−1}(V),b\circ f)$ is a boundary defining function for $X$ at $(x,\tilde{\beta})$, for some unique local boundary component $\tilde{\beta}$ of $X$ at $x$.

At any rate, in the case of manifolds without boundary, smoothness trivially implies weak smoothness.  The proof of Prop. 3.3 apparently follows from Prop. I.1.5 of Moerdijk and Reyes' Models for Smooth Infinitesimal Analysis.  Once I have a chance to get to the library to pick up a copy, I'll try to edit this answer to give a proof for anyone interested.  Until then, it seems that the (tentative) answers to my questions are:

Why is this true?  How is the map f constructed?  See Prop. I.1.5 in the above reference, until I have time to get a copy and digest it.
What about the construction fails if Y has boundary?  Apparently nothing -- an analogous result (with smoothness replaced by weak smoothness) seems to hold for manifolds with boundary and manifolds with corners.
Is this statement true regardless of whether or not $\phi$ is a $C^{\infty}$-ring morphism?  Apparently $\phi$ does need to be a $C^{\infty}$-ring morphism.

