Let $M$ be an $m$-by-$n$ matrix, here are three definitions$^5$ that we could use for rank:

$rk(M) = \min k$ such that for matrices $P$, and $Q$ with $P$ of size $m$-by-$k$ and $Q$ of size $k$-by-$n$ we have $M = PQ$.

$rrk_+(M)$ (3. $crk_+(M)$) is the maximum number of linearly independent rows (columns) of $M$. Where a set $S$ of vectors is linearly independent$^1$ if for all $u \in S$ there is no non-zero $k$ such that $ku$ can be written as a linear combination of vectors in $S - \{u\}$.

Now, if the elements of $M$ come from a field then $rk(M) = rrk_+(M) = crk_+(M)$. However, if we work with modules over a (semi-)rings then the story is different.

**If we are working over a commutative (semi-)ring with no zero divisors$^2$ then how far apart can $rk$, $rrk_+$, and $crk_+$ be?** Can this be bounded in terms of easily computable properties of $M$ and the (semi-)ring? I am primarily interested in finite $M$ and "well-behaved"$^3$ (semi-)rings$^4$.

### Notes

This definition of linear independence is not necessarily equivalent to the 'make the $0$-vector' definition for arbitrary (semi-)rings because (semi-)rings lack minus. I added the there is no non-zero $k$ part (instead of just the $k = 1$ case) after @Manos' answer.

I ask for no zero divisors, because it is easy to come up with separations for general rings. For instance, consider $\begin{pmatrix} 2 & 2 \\ 3 & 3 \end{pmatrix}$ over $\mathbb{Z}_6$ and the obvious generalizations. I am not interested in examples like this because they are in some way an artifact of just the ring, not of the module.

By "well-behaved", I mean you can assume all the nice properties you want since I want the issue to come from the module-ness aspect, not just the the (semi-)ring itself. In fact, I will be more than happy with an answer just for finite (semi-)rings (that meet my other restrictions).

I know that semirings are much less studied than rings, so I will be happy with an answer for integral domains if the "semi-" part makes the question too awkward.

I realize that there are many other definitions of rank and dimension for modules and (semi-)rings. I am interested in these three specific definitions of rank not to generalize fields but because they come up in application and I want to learn how to play with them. I appreciate pointers to other definitions or rank/dimension if you point out how they relate to the definitions I provide.