All rings are assumed to be commutative and unital, with all homomorphisms unital as well.


On last week's homework, there was a mistake in one of the questions:



> 
> 
> > 
> > **(2.5)** Let $R\to S$ be a morphism of commutative rings giving $S$ an $R$-algebra structure. Suppose that the induced maps $R\to S\_{\mathfrak{p}}$ are formally étale for all prime ideals $\mathfrak{p}\subset S$. Then $R\to S$ is formally étale. 
> > 
> > 
> > 
> 
> 
> 


According to our professor, the exercise should have stated additionally that $S$ was finitely presented over $R$ (which allows us to prove that $S$ is in fact étale over $R$ rather than just formally étale). This is not too hard to do and is left as an exercise. (You can also find it in EGA). 


However, I'm interested in seeing either a counterexample or a proof for the stronger claim in the grey box. 



Formally étale at all primes does not imply formally étale?
**EDIT:** Don't bother reading my partial solution. Brian Conrad pointed out that an easier way to do what I did is to use the equivalent definition of formally unramified in terms of Kähler differentials. And later on, fpqc posted below a *complete* solution passed on by Mel Hochster, who got it from Luc Illusie, who got it from ???.


**OLD ANSWER:**
Here is a half-answer. I'll prove half the conclusion, but on the plus side I'll use only half the hypothesis! Namely, I will prove that if $R \to S\_{\mathfrak{p}}$ is formally unramified for all primes $\mathfrak{p} \subset S$, then $R \to S$ is formally unramified.


Let $A$ be an $R$-algebra, and let $I \subseteq A$ be a nilpotent ideal. Given $R$-algebra homomorphisms $f,g \colon S \to A$ that become equal when composed with $A \to A/I$, we must prove that $f=g$. Fix $\mathfrak{p}\subset S$. Then the localizations $A\_{\mathfrak{p}} := S\_{\mathfrak{p}} \otimes\_{S,f} A$ and $S\_{\mathfrak{p}} \otimes\_{S,g} A$ of $A$ (defined viewing $A$ as an $S$-algebra in the two different ways) are naturally isomorphic, since adjoining the inverse of an $a \in A$ to $A$ automatically makes $a+\epsilon$ invertible for any nilpotent $\epsilon$ (use the geometric series). Now $f$ and $g$ induce $R$-algebra homomorphisms $f\_{\mathfrak{p}},g\_{\mathfrak{p}} \colon S\_{\mathfrak{p}} \to A\_{\mathfrak{p}}$ that become equal when we compose with $A\_{\mathfrak{p}} \to A\_{\mathfrak{p}}/I A\_{\mathfrak{p}}$. Since $R \to S\_{\mathfrak{p}}$ is formally unramified, this means that $f\_{\mathfrak{p}} = g\_{\mathfrak{p}}$. In other words, for every $s \in S$, the difference $f(s)-g(s)$ maps to zero in $A\_{\mathfrak{p}}$ for every $\mathfrak{p}$. An element in an $S$-module that becomes $0$ after localizing at each prime ideal of $S$ is $0$, so $f(s)=g(s)$ for all $s$. So $f=g$.


