Restriction of Inverse is Inverse of Restriction

Theorem
Let $S_1$ and $S_2$ be sets.

Let $f: S_1 \to S_2$ be a bijection.

Let $M_1 \subseteq S_1$ be a subset of $S_1$.

Let $f^{-1}$ be the inverse of $f$.

Let $f \restriction_{M_1 \times f\left[{M_1}\right]}$ be the restriction of $f$ to $M_1 \times f\left[{M_1}\right]$.

Let $f^{-1} \restriction_{f\left[{M_1}\right] \times M_1}$ be the restriction of $f^{-1}$ to $f\left[{M_1}\right] \times M_1$.

Then:
 * $f \restriction_{M_1 \times f \left[{M_1}\right]}$ is a bijection

and:
 * $\left({f \restriction_{M_1 \times f \left[{M_1}\right]} }\right)^{-1} = f^{-1} \restriction_{f \left[{M_1}\right] \times M_1}$

Proof
Let $x \in M_1$.

Since $f$ is a bijection, there exists one and only one $y \in f \left[{M_1}\right]$ such that $f(x) = y$.

By definition of the restriction, $\forall z \in M_1 : f \restriction_{M_1 \times f\left[{M_1}\right]}(z) = f(z)$.

Therefore there exists exactly one $y \in f\left[{M_1}\right]$ such that $f \restriction_{M_1 \times f\left[{M_1}\right]}(x) = y$.

Since $x \in M_1$ was arbitrary, $f \restriction_{M_1 \times f\left[{M_1}\right]}$ is a bijection.

By Equivalence of Definitions of Bijection, $(f \restriction_{M_1 \times f\left[{M_1}\right]})^{-1}$ is a mapping.

Let $y \in f\left[{M_1}\right]$.

Let $x = f^{-1}(y)$.

Since $f$ is bijective, this is equivalent to $f(x) = y$.

Since $\forall z \in M_1 : f \restriction_{M_1 \times f\left[{M_1}\right]}(z) = f(z)$, $f \restriction_{M_1 \times f\left[{M_1}\right]} (x) = f(x)$.

Since $f \restriction_{M_1 \times M_2}$ is bijective, this is equivalent to $(f \restriction_{M_1 \times f\left[{M_1}\right]})^{-1}(y) = x$

Therefore, $f^{-1}(y) = (f \restriction_{M_1 \times f\left[{M_1}\right]})^{-1}(y)$.

By definition of the restriction, $\forall z \in f\left[{M_1}\right] : f^{-1} \restriction_{f\left[{M_1}\right] \times M_1}(z) = f^{-1}(z)$.

By transitivity of equality, $(f \restriction_{M_1 \times f\left[{M_1}\right]})^{-1}(y) = f^{-1} \restriction_{f\left[{M_1}\right] \times M_1}(y)$.

Since $y \in f\left[{M_1}\right]$ was arbitrary, $(f \restriction_{M_1 \times f\left[{M_1}\right]})^{-1} = f^{-1} \restriction_{f\left[{M_1}\right] \times M_1}$.