When to use ":="?

107 Views Asked by At

I know that "$:=$" is used in definitions. For example, one can write:

$A\times B:=\{(a, b)\mid a\in A, b\in B\}$

But would you use "$:=$" in the following example:

Let a function $f\colon A\to \{0, 1\}^A$ be given. Define $g\colon A\to\{0, 1\}$ as follows: For each $a\in A$, set $g(a):=0$ if $(f(a))(a)=1$ and $g(a):=1$ if $(f(a))(a)=0$.

?