Let $U$ be an unbounded subset of $\mathbb{N}$.
Let $D = \mathcal{P}_{<\omega}(U)$ (the set of all finite subsets of $U$).
Let $f$ be an injection such that: $f: D \rightarrow \mathbb{N} $
Intuitively: let $f$ be a function that uniquely assigns a natural number to an arbitrarily long set.
I can think of three interesting examples of $f$:
Prime products
Let $U$ be the set of all prime numbers. Let $f$ be a function that outputs a product of all elements of the argument.
For example: $f(\{2, 3, 11\}) = 2\times3\times11 = 66$
No two distinct prime sets may ever produce duplicate numbers, due to the fundamental theorem of arithmetic. Therefore, $f$ is injective.
Power sums
Let $U = \mathbb{N}$
Let $b\in\mathbb{N}, b > 1 $
Let $A\in{D}$
$$f_{b}(A) = \sum_{a \in A} b^{a} $$
For example: $f_{2}(\{4, 5, 8\}) = 2^4 + 2^5 + 2^8 = 304$
We can treat any argument of $f_{b}$ as a number in base $b$ such that each element of the argument signifies the position at which we place digit $1$. Therefore:
$f_{2}(\{4, 5, 8\}) = 100110000_{2} = 304_{10}$
As such, $f_{b}$ is injective for every specified $b$.
Factorial sums
Let $U = \mathbb{N}$ and let $f$ be a function that outputs a sum of factorials of all elements of the argument.
For example: $f(\{4, 5, 8\}) = 4! + 5! + 8! = 40464$
Since the factorial number system uniquely represents any positive integer, we can treat any argument of $f$ as a number such that each element of the argument signifies the position at which we place digit $1$. So:
$f(\{4, 5, 8\}) = 1_{9}0_{8}0_{7}1_{6}1_{5}0_{4}0_{3}0_{2}0_{1} = 40464_{10}$
As such, $f$ is injective. (Note that the place value is one less than the radix position)
First question: What other interesting examples of $f$ do we know that are not necessarily sums of powers? Is there a way to describe what such a function can and cannot be? Is it any easier should we extend the codomain of $f$ to $\mathbb{R}$?
Second question: If we define $D$ as the set of all possible multisets (instead of subsets) such that every element of the multiset is inside $U$, has mankind discovered any working example of $f$ apart from the prime products example?
Yes, there is indeed a bijection $R$ ("Ranking function") from the set of all finite multisubsets of $\mathbb{N^{+}}$ to $\mathbb{N^{+}}$.
To show this we will prove that its inverse $R^{-1}$ ("Unranking function") is bijective. Here's what it looks like by the way:
Can you already spot the rule? If not, read on!
Indexed collections of multisets
Let $m, n, l \in \mathbb{N^{+}}.$
Let $$F(n, l) = \{M: |M| = l \wedge m \in M \Rightarrow m \leq n \wedge n \in M \} $$ Intuitively: let $F(n, l) $ be a collection of multisets $M$ of length $l$ where every element is less than or equal to $n$ and there's at least one $n$ inside $M$ (simply: $F(n, l) = $ multisets of length $l$ whose maximal element is $n$).
Examples: $$F(2, 3) = \{\{1, 1, 2\}, \{1, 2, 2\}, \{2, 2, 2\}\}$$ $$F(4, 2) = \{\{1, 4\},\{2, 4\},\{3, 4\},\{4, 4\}\}$$
Let $\mathbb{M}$ denote the set of all finite multisubsets of $\mathbb{N^{+}}$.
Notice that for every $M \in \mathbb{M}$ we can find a collection $F(n, l)$ that it belongs to.
We find $n, l$ as follows:
This way all three conditions for $F(n, l)$ hold.
Now notice that every $M \in \mathbb{M}$ belongs to exactly one collection $F(n, l)$.
It's because if $M$, for which we've found some working $n, l$, could belong to some other $F(a, b), a \neq n \vee b \neq l $, it would mean that either
Concatenating all collections
Now, consider an infinite sequence of collections $$C = (F(1, 1), F(2, 1), F(1, 2), F(3, 1), F(2, 2), F(1, 3), F(4, 1), F(3, 2)...)$$
To obtain $C_{n}$, which is the $nth$ element of this sequence, we construct $F(x, y)$ such that:
Notice that for any $a, b \in \mathbb{N^{+}}$, there is exactly one occurence of $F(a, b)$ in $C$.
Now if $S$ is some set of some multisets, let $L(S, k)$ denote the $kth$ element (that is a multiset) taken from $S$ in lexicographical order.
Let us define a helper function $g$:
$$g(n, i) = \begin{equation} \begin{cases} L(C_{i}, n) & \text{if}\ n \leq |C_{i}| \\ g(n - |C_{i}|, i+1) & \text{otherwise} \end{cases} \end{equation} $$
We can then define our multiset unranking function (the one whose values I've listed at the beginning): $$R^{-1}: \mathbb{N^{+}} \rightarrow \mathbb{M} $$ $$R^{-1}(n) = g(n, 1)$$
Intuitively: we list all multisets of all collections in order specified by $C$ in a single row and we take the $nth$ multiset from the list. Example: if the first four collections have $1$ multiset each and the fifth one has $2$, then $R^{-1}(4)$ maps to the only element of the fourth collection, $R^{-1}(5)$ maps to lexicographically first element of the fifth collection and $R^{-1}(6)$ maps to lexicographically second element of the fifth collection.
As we increase $n$, we eventually obtain every element of every $F(a, b)$ for every possible pair of positive integers $(a, b)$.
Since we've proven that every $M \in \mathbb{M}$ belongs to some $F(a, b)$, we see that $R^{-1}$ is onto, because we will eventually find this $M$ by increasing $n$.
Since we've proven that every $M \in \mathbb{M}$ belongs to one $F(a, b)$ and elements of a particular $F(a, b)$ cannot repeat (by definition of set), $R^{-1}$ is injective, because two inequal arguments of $R^{-1}$ map to either different elements of different collections or different elements of the same collection.
It follows immediately that there exists a function $R: \mathbb{M} \rightarrow \mathbb{N^{+}} $ which is obviously injective as well and whose existence answers the original question.
Curio: comparing $R^{-1}$ with prime factorizations
Let $D = \mathbb{N^{+}} \setminus \{1\}$
We can trivially observe that a function $f^{-1}$ that takes some $n$ and outputs a multiset with ordinals of primes that factorize $n$ is a bijection $$f^{-1}: D \rightarrow \mathbb{M} $$
Examples: $$f^{-1}(10) = f^{-1}(2 \times 5) = \{1,3\}$$ $$f^{-1}(18) = f^{-1}(2 \times 3 \times 3) = \{1,2,2\}$$
It kind of unranks an integer into a finite multisubset of $\mathbb{N^{+}}$.
Sounds familiar? Now what if we compare results of $f^{-1}$ and $R^{-1}$? Could there finally be some order in factorizations? To see this, let us define $f$: $$f: \mathbb{M} \rightarrow D $$ $$f(M) = \prod_{m \in M} p_{m} $$
Obviously, $f(f^{-1}(n)) = n$, for $n \in D$.
How about $f(R^{-1}(n))$ for $n \in \mathbb{N^{+}}$?
Here's the plot of this:
Notable properties:
Otherwise chaos, unfortunately. Or maybe we do not yet have eyes to see order?