Define a function $g: \mathbb{N}_0\;\times\;\mathbb{N}_0 \rightarrow \mathbb{N}_0$
Let it have such properties:
1) $g(x,y) = g(y,x)$
2) $g(x,y) = x$, if and only if $y$ is divisible by $x$
3) $g(g(x,y), z) = g(x, g(y,z))$
Prove that $g(x,y) = \gcd(x,y)$
Intuitively I understand that GCD has all these same properties but I guess that it is not enough. In general showing that one function is the same as another one, we must prove that these functions have same value on all possible sets of arguments. Please, show me how to prove such facts in formal way.