Let $k$ be a field, and let $f : k[t_1,\dots, t_r]\to k[x_1,\dots, x_n]$ be the $k$-algebra map defined by $f(t_i) = f_i\in k[x_1,\dots, x_n].$ Suppose that the $f_i$ are algebraically independent over $k,$ so that the map $f$ is an injection. To show that $f$ is flat, it suffices to show that $f_\mathfrak{m} : k[t_1,\dots, t_r]\to k[x_1,\dots, x_n]_\mathfrak{m}$ is flat for $\mathfrak{m}\subseteq k[x_1,\dots, x_n]$ an arbitrary prime ideal. If $(f_1,\dots, f_r)\subseteq\mathfrak{m},$ then $f_\mathfrak{m}$ is flat if and only if the $f_i$ form a regular sequence in $k[x_1,\dots, x_n]_\mathfrak{m}$ (c.f. Eisenbud's *Commutative Algebra*, exercise 18.18).

In general, we cannot expect that the $f_i$ form a regular sequence in every $k[x_1,\dots, x_n]_\mathfrak{m}.$ However, suppose that if they do fail to form a regular sequence, they fail in a "silly" way: by some of the $f_i$ becoming units in $k[x_1,\dots, x_n]_\mathfrak{m}.$ My question is, does flatness still hold if some of these $f_i$ become units? In particular, can we generalize exercise 18.18 of Eisenbud's *Commutative Algebra* to say:

Let $(R,\mathfrak{m})$ be a Noetherian local ring containing a field $k,$ and let $x_1,\dots, x_r\in\mathfrak{m}$ and $u_1,\dots, u_s\in R^\times$ be two sequences of elements. Then $i : k[x_1,\dots, x_r, u_1, \dots, u_s]\to R$ is flat if $x_1,\dots, x_r$ is a regular sequence.

**Edit:** Above I am happy to interpret $k[x_1,\dots, x_r, u_1, \dots, u_s]$ as either the $k$-subalgebra of $R$ generated by the $x_i$ and $u_i$ or as a polynomial ring over $k$ in the $x_i$ and $u_i$ (mapping to $R$ by sending each variable to the corresponding element). In the situation I am concerned with, these coincide, so I would be interested in results about either situation.

**Edit 2:** As noted in the comments to Eric's answer below, this problem could also be stated as follows:

Suppose that $k$ is a field, and that $(R,\mathfrak{m})$ is a Noetherian local ring containing $A := k[t_1^{\pm1},\dots, t_s^{\pm1}].$ Let $x_1,\dots, x_r$ be a sequence of elements in $\mathfrak{m}.$ Then $i : A[x_1,\dots, x_r]\to R$ is flat if $x_1,\dots, x_r$ is a regular sequence.

The map $i$ above will be flat if and only if $A[x_1,\dots, x_n]_\mathfrak{n}\to R$ is flat, where $\mathfrak{n} = i^{-1}(\mathfrak{m}).$ Moreover, assuming that $R$ is Cohen-Macauley (which I am happy to do), this map is flat if and only if $\dim R = \dim A[x_1,\dots, x_r]_\mathfrak{n} + \dim R/\mathfrak{n}R,$ but I'm not sure how to get a handle on $A[x_1,\dots, x_r]_{\mathfrak{n}}$ (or $\dim R/\mathfrak{n}R$) in general. (The proof of the exercise mentioned above does not generalize immediately to this situation: $\mathfrak{n}$ need not be simply $(x_1,\dots, x_n)A[x_1,\dots, x_r];$ there could be contributions coming from the $t_i.$)

As an example, we might consider the injection $k[u]\to k[x]_{(x)},$ where $u = 1/(1+x).$ In this case the preimage of $(x)$ is $(1 - u),$ so $k[u]\to k[x]_{(x)}$ is flat because $k[u]_{(1 - u)}\to k[x]_{(x)}$ is an isomorphism. The result is true in this very simple example, but I'm not sure that it suggests a more general approach.