Regular ring is smooth when the field is perfect Take $A$ a (not necessarily local) commutative algebra over a field $k$ which is essentially of finite type (i.e. a localization of a finitely generated algebra). In simple words, I just want to know a clear proof for this fact:

If $k$ is perfect and $A$ is regular, then $A$ is formally smooth over $k$.

Here, $A$ is regular if its localization at every prime ideal is local regular, and $A$ is smooth as a discrete ring like in this sense (or in one of the many possible definitions in appendix E of Loday's book).
One partial answer to this was given in a previous question. However, two assumptions made there do not let me see the result clearly in my context (probably because I'm not acquainted sufficiently with the theory):

*

*$A$ is assumed to be local

*$A$ is proved to be smooth in the $\mathfrak{m}$-adic topology

Note that the converse was proved here using André-Quillen (co)homology. So, I have the following side question: is there some way to derive a proof by using this (co)homology?
 A: Here's an easy proof: write $A = S^{-1}B$ for some finite type $k$-algebra $B$ and a multiplicative set $S$. Since $k$ is perfect, a localisation $B_{\mathfrak p}$ at a prime $\mathfrak p \subseteq B$ is regular if and only if it is smooth [Tag 00TV]. Moreover, the set of smooth points forms a Zariski open $U \subseteq \operatorname{Spec} B$, since it is the locus where $\Omega_{B/k}$ has the expected dimension.
A localisation $B \to S^{-1}B =A$ induces an inclusion $\operatorname{Spec} A \hookrightarrow \operatorname{Spec} B$ whose image consists of those primes $\mathfrak p \subseteq B$ such that $\mathfrak p \cap S = \varnothing$. This map induces isomorphisms $A_{\mathfrak p} \cong B_{\mathfrak p}$ (or really we should write $A_{S^{-1}\mathfrak p}$ where $S^{-1}\mathfrak p$ is the corresponding prime in $A$). By assumption, all $A_{\mathfrak p}$ are regular, hence smooth, so they all lie in $U$.
Thus if $Z_1,\ldots,Z_n$ are the irreducible components of the complement $Z = \operatorname{Spec} B \setminus U$, and $\mathfrak p_1,\ldots,\mathfrak p_n$ are the corresponding prime ideals, then $\mathfrak p_i \cap S$ contains an element $f_i$ for each $i$. Setting $f = f_1 \cdots f_r$, we conclude that $f \in S$ and $\operatorname{Spec} A \hookrightarrow \operatorname{Spec} B$ lands in the standard affine open $\operatorname{Spec} B_f \subseteq U$. Thus $B_f$ is smooth over $k$, and $A$ is obtained as a localisation of a smooth $k$-algebra, hence formally smooth.
