Cardinal of maximal linearly independent subsets of a free module

I think I have a counter-example. Let $A$ be the ring of functions $f$ from $\mathbb{C}^2 \setminus (0,0) \to \mathbb{C}$ such there is a polynomial $\widetilde{f} \in \mathbb{C}[x,y]$ such that $\widetilde{f}(x,y)=f(x,y)$ for all but finitely many $(x,y)$ in $\mathbb{C}^2$.

Map $A$ into $A^2$ by $f \mapsto (fx, fy)$. We check that this is injective: If $fx=0$ then $f$ is zero off of the $x$-axis. Similarly, if $fy=0$, then $f$ is zero off of the $y$-axis. So $(fx, fy) = (0,0)$ implies that $f$ is zero everywhere on $\mathbb{C}^2 \setminus (0,0)$.

We now claim that there do not exist $(u,v)$ in $A^2$ such that $(f,g) \mapsto (fx+gu, \ fy+gv)$ is injective. Suppose such a $(u,v)$ exists. Let $\widetilde{u}$ and $\widetilde{v}$ be the polynomials in $\mathbb{C}[x,y]$ which coincide with $u$ and $v$ at all but finitely many points. Let $\Delta=\widetilde{u} y - \widetilde{v} x$. Since $\Delta$ is a polynomial which vanishes at $(0,0)$, it is not a non-zero constant. Thus, $\Delta$ vanishes on an entire infinite subset of $\mathbb{C}^2$. Let $(p,q)$ be a point in $\mathbb{C}^2 \setminus (0,0)$ such that $\Delta(p,q)=0$, $\widetilde{u}(p,q)= u(p,q)$ and $\widetilde{v}(p,q)=v(p,q)$.

So $q u(p,q) - p v(p,q) =0$. Since $(p,q) \neq (0,0)$, there is some $k \in \mathbb{C}$ such that $(u(p,q), v(p,q)) = (kp, kq)$. Take $f$ to be $-k$ at $(p,q)$ and $0$ elsewhere; let $g$ be $1$ at $(p,q)$ and $0$ elsewhere. So $(fx+gu, fy+gv)=0$, and the map $(f,g) \mapsto (fx+gu, \ fy+gv)$ is not injective.


We have to prove that $m \leq n$ if there is a monomorphism $A^m \to A^n$. Since this is given by a $n \times m$ matrix with entries in $A$ and every finitely generated ring is noetherian, it is enough to consider the case that $A$ is noetherian.

Now you already know the proof for this case, but I just add it. Pick a minimal prime ideal $\mathfrak{p} \subseteq A$. This exists since $A \neq 0$. Now localize at $\mathfrak{p}$. Then we may replace $A$ by $A_{\mathfrak{p}}$, and thereby assume that $A$ is a $0$-dimensional noetherian ring, thus artinian. For such a ring it is known that the length of finitely generated modules is finite, and additive on short exact sequences. In particular $m * l(A) \leq n * l(A)$. Since $l(A) \neq 0$ is finite, we get $m \leq n$.

By the way, the assertion can be generalized to the infinite case:

Let $M$ be a free module with basis $B$ and $L \subseteq M$ a linearly independent subset. Then $|L| \leq |B|$.

Proof: Let $B$ be infinite. Representing elements of $L$ as linear combinations of elements in $B$ yields a map $f : L \to E(B)$, where $E(B)$ denotes the set of finite subsets of $B$. Now let $F$ be such a finite subset with $n$ elements. The finite case yields that there are at most $n$ linearly independent elements in $\langle F \rangle$, thus also in $f^{-1}(F)$. Now we use cardinal arithmetics:

$|L| = \sum_{n > 0} \sum_{F \in E(B), |F|=n} |f^{-1}(F)| \leq \sum_{n > 0} |B^n| = \sum_{n > 0} |B| = |B|.$

EDIT: See the comments; this does not answer kwan's question yet.