Geometric intuition behind locality of morphisms of locally ringed spaces

Let $(X,\mathcal O_X)$ be a locally ringed space. The examples I have in mind are sheaves of continuous/$C^k$/smooth/etc. functions over a suitable topological space.

The direction $f^\sharp:\mathcal O_Y\rightarrow f_\ast\mathcal O_X$ of a morphism $(X,\mathcal O_X)\rightarrow (Y,\mathcal O_Y)$ is clear to me, but I am struggling to understand the geometric significance of respecting the maximal ideals. I don't know commutative algebra so excuse the question if it's a well discussed triviality.

First, let's switch from $f^\sharp:\mathcal O_Y\rightarrow f_\ast\mathcal O_X$ to $f^\flat:f^\ast\mathcal O_Y\rightarrow \mathcal O_X$. Now we can look at a map between the stalks at $x\in X$: $$\mathcal O_{Y,f(x)}\rightarrow \mathcal O_{X,x}$$ The maximal ideal $\mathfrak m_{f(x)}\vartriangleleft \mathcal O_{Y,f(x)}$ is comprised of the nonzero germs at $f(x)$. These are just the locally non-invertible functions at $f(x)$. To map $\mathfrak m_{f(x)}$ into $\mathfrak m_x$ is to say we do not accidentally invert any nonunits in $\mathcal O_{Y,f(x)}$.

This sounds like a good thing at the formal level, but what are some interesting geometric examples in which not being a local homomorphism has unpleasant consequences?

• A lot of things would just not be true if you don't assume that the induced maps on the stalks is local. For example it would not be true that every Morphism(of schemes) $Spec(B)\rightarrow Spec(A)$ is induced by a ringhomomorphism $A \rightarrow B$, more precisely there is an equivalence of categories from affine schemes to Rings. – math635 Dec 19 '15 at 17:10
• @math635 I'm sure all the definitions are perfect as they are, especially at a formal level. I just want some geometric examples to feel things out. – Arrow Dec 19 '15 at 17:12
• The way to think about it is that it ensures that functions vanishing at a point continue to vanish at that point. – Zhen Lin Dec 19 '15 at 17:13
• @ZhenLin maybe I'm confusing directions but you're saying that if some germ is zero at $f(x)$, then we want to ensure its "pullback" is zero at $x$. But why do we want this geometrically? – Arrow Dec 20 '15 at 0:54

Perhaps it's more helpful to think about curves if you're not comfortable with commutative algebra. If you consider a curve $f(x,y)=0$ over $\mathbb{C}$, then the sheaf of regular functions on the curve has stalks $(\mathbb{C}[x,y]/(f(x,y)))_{(x-a,y-b)}$, which is the coordinate ring localized at the point $P = (a,b)$. So each element of the stalk is an equivalence class of polynomials on the curve $f(x,y)$ with possible poles at points not equal to $P$. In other words, we look polynomial functions in $x$ and $y$, group them together by which ones evaluate the same on the points of the curve, and allow them to have finitely many poles away from $P$, since we only care about the local information in stalks.
When we want to map another curve $g(x,y)$ to the curve $f(x,y)$, then an important property that we want to have is that every time we have a function $p(x,y)$ on the curve $f(x,y)$, taking the curve to $\mathbb{C}$, then we get a function from $g(x,y)$ to $\mathbb{C}$. If you think about it, this is a very natural property to want: after all, we have a map from $g$ to $f$ and from $f$ to $\mathbb{C}$. This, you said, is pretty clear to you, and gives the direction of the map $f^\sharp$ from $\mathcal{O}_{f} \to f_* \mathcal{O}_{g}$.
Then, suppose that we broke our rule, and the induced map on stalks gave some function in the maximal ideal of the stalk of $\mathcal{O}_f$ at $P$ which maps to some function which is not in the maximal ideal of the stalk of $\mathcal{O}_g$ at $Q \in f^{-1}(P)$ (and let's suppose there is some point $Q$, so that something interesting happens). Then we took a very nice function on the curve $f(x,y)$ to $\mathbb{C}$ which evaluated to zero at $P$ and we got a function from $g$ to $\mathbb{C}$ which does not evaluate to zero at $Q$. This should make not very much sense, because if we literally had functions, not just sections in a sheaf, and could compose the function $f$ to $\mathbb{C}$ with the function taking the curve $g$ to $f$ then, $Q$ would map to $P$ under the curve map and $P$ would map to $0$ under the polynomial in the maximal ideal of the stalk. So, in order for the morphism of locally ringed spaces to emulate the behavior we see on varieties, it makes sense to require that the induced map on the stalks map relate the maximal ideals in this way.