Subset enumeration by size is not primitive recursive?

57 Views Asked by At

For integers $N\geq n \geq 1$, let

$$ S_{N,n}=\Bigg\lbrace (x_1,x_2,\ldots,x_N)\in \lbrace 0,1 \rbrace ^N \ \Bigg| \sum_{k=1}^{N} x_k=n \ \Bigg\rbrace $$ Note that $S_{N,n}$ is naturally in bijection with the $n$-subsets of $[1..N]$, so that $S_{N,n}$ has cardinality $\binom{N}{n}$.

Let $f:{\mathbb N}^4 \to {\mathbb N}$. I say that $f$ is a subset-enumerating function iff for all $N\geq n\geq 1$,

$$ \Bigg\lbrace (f(N,n,k,1),f(N,n,k,2),\ldots,f(N,n,k,N)) \ \Bigg| 1 \leq k \leq \binom{N}{n} \ \Bigg\rbrace=S_{N,n} $$ Question : can $f$ be subset-enumerating and primitive recursive at the same time ?

My thoughts : I think that the answer is NO because heuristically this kind of enumeration is related to Goedel numbering and demands a complexity higher than just primitive recursive.

Closely related : Closed-Form Solution for Permutation Table

1

There are 1 best solutions below

3
On BEST ANSWER

You should understand that any function with time complexity in the Exponential Hierarchy is recursive primitive... I think that you can find a program that compute $f$ in polynomial time, but even with exponential time (or double exponential time $O(2^{2^n})$), it's enough to prove it is recursive primitive.

As your definition is very simple, $f(N,n,k,i)$ can enumerate all elements of $\{0,1\}^N$ and stop to the $k^{th}$ element that is in $S_{N,n}$ and return its $i^{th}$ component. This is not a very optimized program, but it's enough to proof that $f$ is recursive primitive. In fact, it's very hard to define non primitive function (almost impossible without double recursion like for Ackermann function or without using universal machine like the halting problem).