Inverse of Cantor Pairing Function

Theorem
Let $\pi : \N^2 \to \N$ be the Cantor pairing function.

Let $\pi_1 : \N \to \N$ be defined as:
 * $\ds \map {\pi_1} z = z - \frac {w \paren {w + 1}} 2$

where:
 * $\ds w = \floor {\frac {\sqrt {8z + 1} - 1} 2}$

Let $\pi_2 : \N \to \N$ be defined as:
 * $\map {\pi_2} z = w - \map {\pi_1} z$

Then, for every $x, y \in \N$:
 * $\map {\pi_1} {\map \pi {x, y}} = x$
 * $\map {\pi_2} {\map \pi {x, y}} = y$