Composition of Mapping with Mapping Restricted to Image

Theorem
Let $A, B, C$ be sets.

Let $f : A \to B, g: B \to C$ be mappings.

Let $g \circ f : A \to C$ denote the composite mapping of $f$ with $g$.

Let $f \sqbrk A$ denote the image of $f$.

Let $f \restriction_{A \times f \sqbrk A} : A \to f \sqbrk A$ denote the restriction of $f$ to $A \times f \sqbrk A$.

Let $g \restriction_{f \sqbrk A} : f \sqbrk A \to C$ denote the restriction of $g$ to $f \sqbrk A$.

Let $g \restriction_{f \sqbrk A} \circ f \restriction_{A \mathop \times f \sqbrk A} : A \to C$ denote the composite mapping of $f$ with $g$.

Then:
 * $g \circ f = g \restriction_{f \sqbrk A} \circ f \restriction_{A \mathop \times f \sqbrk A}$