Suppose this set:
$S = \{A, B, C, D\}$
and
$S\times S = \{AA, AB, AC, AD, BA, BB, BC, BD, CA, CB, CC, CD, DA, DB, DC, DD\}$
I want a function such that: $f(P) = p$
where $P \in S \times S$ and $p \in [0, 16)$ and $f(P)$ is a one-to-one. Lastly, $f(P)$ needs to be some sort of calculation, not an arbitrary mapping.
How can I do this (you can assign number values to elements in $S$)?