All Bases of Matroid have same Cardinality

Theorem
Let $M = \struct{S, \mathscr I}$ be a matroid.

Let $\rho : \powerset S \to \Z$ be the rank function of $M$.

Let $B$ be a base of $M$.

Then:
 * $\size B = \map \rho S$

That is, all bases of $M$ have the same cardinality, which is the rank of $S$.

Proof
By definition of the rank function:
 * $\map \rho S = \max \set{\size X : X \subseteq S, X \in \mathscr I}$

Let $B_1$ be an independent subset such that:
 * $\size {B_1} = \map \rho S$

Let $X$ be an independent superset of $B_1$.

From :
 * $\size {B_1} \le \size X$

By choice of $B_1$:
 * $\size X \le \size {B_1}$

It follows that:
 * $\size X = \size {B_1}$

From :
 * $X = B_1$

It follows that $B_1$ is a maximal independent subset.

That is, $B_1$ is a base.

Let $B_2$ any other base.

Aiming for a contradiction, suppose $\size {B_2} < \size {B_1}$.

From Leigh.Samphier/Sandbox/Independent Set can be Augmented by Larger Independent Set there exists $Z \subseteq B_1 \setminus B_2$ such that:
 * $B_2 \cup Z \in \mathscr I$
 * $\size{B_2 \cup Z} = \size{B_1}$

This contradicts the maximality of $B_2$ in $\mathscr I$.

So:
 * $\size {B_2} \ge \size {B_1}$

By choice of $B_1$:
 * $\size {B_2} \le \size {B_1}$

Then:
 * $\size {B_2} = \size {B_1} = \map \rho S$