dim -- compute the Krull dimension

Caveat

To compute the dimension of a vector space, one should use rank.

Over the integers, the computation effectively tensors first with the rational numbers, yielding the wrong answer in some cases.