The term ‘rank’ is used in many contexts to number levels within a hierarchy.
A collection of elements of is called a basis of (over ) if for every there is a unique collection of elements of such that for all but finitely many and .
If has a basis it is called free (over ). For many examples of (the invariant basis number rings), the cardinality only depends on and not on the choice of basis. It is called the rank of over , notation: . In any case, is called the free module of rank . If is a finitely generated free module then the rank is finite.
All of the following are invariant basis rings (source: Wikipedia):
Besides the trivial ring (over which any module is free with any set as basis), an example of a ring without invariant basis number is the ring of -dimensional square matrices (over any ring) in which each column has only finitely many nonzero entries (which allows multiplication to be defined). As a module over itself, this ring is free on any inhabited finite set, as may be shown by using the equation (applied to the columns).
If is of finite type, then the rank at can equivalently be defined as the minimal number of elements needed to generate the stalk as a -module (by Nakayama's lemma). In this case, the rank is a upper semicontinuous function .
In the internal language of the sheaf topos , the rank of can internally quite simply be defined as the minimal number of elements needed to generate (taken as an element of the suitably completed natural numbers, i.e. the poset of inhabited upper sets). Under the correspondence of internal inhabited upper sets in and upper semicontinuous functions (details at one-sided real number), this definition coincides with the usual one if is of finite type; see this MathOverflow question.
See also rank of a coherent sheaf.
We may define this rank explicitly (and recursively) as follows: