The rank of a subset S of a matroid is the size of a maximal independent subset of S. The map 2^E $\to \mathbb{N}$, S $\mapsto$ rank(S), is called the rank function, and completely determines the matroid.

i1 : M = matroid({a,b,c,d},{{a,b},{a,c}}) o1 = a matroid of rank 2 on 4 elements o1 : Matroid |

i2 : for s in subsets M_* do print(toString s | " has rank " | rank_M s) {} has rank 0 {a} has rank 1 {b} has rank 1 {a, b} has rank 2 {c} has rank 1 {a, c} has rank 2 {b, c} has rank 1 {a, b, c} has rank 2 {d} has rank 0 {a, d} has rank 1 {b, d} has rank 1 {a, b, d} has rank 2 {c, d} has rank 1 {a, c, d} has rank 2 {b, c, d} has rank 1 {a, b, c, d} has rank 2 |

- rank(Matroid) -- rank of a matroid