Composite of Mapping with Inverse of Another is Identity implies Mappings are Equal

Theorem
Let $A$ and $B$ be classes.

Let $f$ and $g$ be mappings on $A \times B$.

Let $f$ and $g$ be such that:
 * $f \circ g^{-1} = I_B$

where:
 * $g^{-1}$ denotes the inverse of $g$
 * $I_B$ denotes the identity mapping on $B$
 * $\circ$ denotes composition of mappings.

Then:
 * $f = g$

Proof
Let $\tuple {a, b} \in f$.

Then because $\tuple {b, b} \in I_B$ we must have:
 * $\tuple {b, a} \in g^{-1}$

and so by definition of inverse of mapping:
 * $\tuple {a, b} \in g$

Hence:
 * $f \subseteq g$

Let $\tuple {a, b} \in g$.

Then by definition of inverse of mapping:
 * $\tuple {b, a} \in g^{-1}$

Then because $\tuple {b, b} \in I_B$ we must have:
 * $\tuple {a, b} \in f$

Hence:
 * $g \subseteq f$

Hence by definition of set equality:
 * $f = g$