Constructing function for set enumeration

64 Views Asked by At

Let $X$ be a set of non-negative integers.

Let $X^i$ denote $i$-th cartesian power of set $X$.

Let $X^* = \bigcup\limits_{i=1}^\inf X^i$, i.e. all possible combinations of $X$'s elements.

Let $\sigma(\overline{x}) = \sum\limits_{i = 1}^n x_i$, where $n$-tuple $\bar{x} \in X^n$ and $x_i$ is it's $i$-th element.

Let $\Sigma_X = \{\sigma(\bar{x}):\overline{x} \in X^*\}$ i.e. set of sums of all possible combinations of $X$'s elements.

Now, I want to enumerate this set, i.e. construct a function $\epsilon:\mathbb{N} \rightarrow \mathbb{\Sigma_X}$ such that for each $n \in \mathbb{N}$, $\epsilon(n)$ is $n$-th smallest number.

Is this possible for arbitrary $X$? If so, how?

1

There are 1 best solutions below

0
On BEST ANSWER

In other words, $\Sigma_X$ is the set of all numbers that can be written as finite nonempty sum of elements of $X$, allowing repetitions.

We'll need to assume that $X$ is decidable, otherwise all bets are off. (Of course there are some undecidable $X$ for which we can enumerate $\Sigma_X$, such as whenever $1\in X$).

However if we can decide $X$, then it's trivial to enumerate $\Sigma_X$ in increasing order by dynamic programming:

 let S = the empty set
 for n = 0 to infinity do
     if n is in X then
         let S = S union {n}
     for m in S do
         if n-m is in X then
             let S = S union {n}
     if n is in S then
         output n (and continue)