0

Let $\mathbb{Z}_+ = \{1,2,3,\ldots\}$. I would like to find an injective function $f:\mathcal{P}(\mathbb{Z}_+) \to \mathbb{R}$. My idea is as follows. Given a subset $A = \{x_1,x_2,\ldots\} \subset \mathbb{Z}_+$, order it such that $x_1<x_2<\ldots$, and also suppose that $x_i$ has $n_i$ digits. Then we map: $$ A \mapsto 0.(0)_{n_1}x_1(0)_{n_2}x_2,\ldots $$ where $(0)_i$ means $i$ consecutive $0$’s. So, for example: $$ \{3,5,7\} \mapsto 0.030507 \\ \{357\} \mapsto 0.000357 $$

My specific question is: can anyone give me a hint or some ideas to prove that this is indeed an injection?

Tian Vlasic
  • 1,436
tree3498
  • 165
  • The usual example is to put a $1$ in the $i^{th}$ place if and only if $i$ is in your subset, and to place a $0$ there if it is not. This question must be a duplicate though...I'll search for a copy – lulu Mar 02 '25 at 20:33
  • here is a duplicate, but it doesn't really write out a full answer. – lulu Mar 02 '25 at 20:37
  • 1
    @lulu: the post certainly isn't a duplicate: it states specifically that the OP wants to know how to prove that the stated construction yields an injection. – Rob Arthan Mar 02 '25 at 21:41
  • @RobArthan Fair point. – lulu Mar 02 '25 at 21:43

1 Answers1

2

Your construction does indeed give an injection $\Bbb{P}(\Bbb{Z}_+) \to \Bbb{R}$, although it needs to be explained that when you write $\ldots (0)_{n_1}x_1(0)\ldots$, "$x_1$" denotes a sequence of decimal digits without leading zeroes that represents the positive integer $x_1$ (and so on for each $x_n$).

On that understanding, you just need to show how to recover the $x_n$ from $A \mapsto 0.(0)_{n_1}x_1(0)_{n_2}x_2,...$ and that is easy to do in stages:

  1. At stage $1$ you are initially looking at the first digit after the decimal point (which must be a zero), you then work right along the digits until you find a non-zero, counting the number of zeroes you have encountered as you go; at this point you have seen $d_1$ zeroes say, so you now interpret the next $d_1$ digits as a decimal number and that is $x_1$;
  2. You are now in stage 2 and are looking at the first zero after $x_1$ in the input, proceeding just as in stage 1, you work right counting zero digits until you find a non-zero digit at count $d_2$, you then proceed to interpret the next $d_2$ digits as a decimal number and that is $x_2$;
  3. and so on $\ldots$.

The approach mentioned in the comments using binary representations is quite a bit easier to work with, but your approach certainly works.

Rob Arthan
  • 51,538
  • 4
  • 53
  • 105
  • Note that the construction of a left inverse requires at least some form of omniscience principle to decide whether there is a next non-zero digit. On the other hand, I conjecture that it is possible to show that the map is injective constructively (assuming we are talking about decidable subsets of $\mathbb{Z}^+$). – Naïm Camille Favier Mar 02 '25 at 21:52
  • @NaïmFavier: it is a pre-condition of the algorithm that I have described that the input is an encoding of the prescribed form - the algorithm will detect whether the pre-condition fails on all inputs except ones that are only finitely non-zero. I am not sure how you could make it more constructive, but am interested to hear more about your thoughts. – Rob Arthan Mar 02 '25 at 22:05
  • PS: actually I should have said the algorithm will detect whether the pre-condition fails on all inputs except those that have an initial segment that correctly represents a finite sequence of positive integers but that is followed by an infinite sequence of zeroes. (It will detect errors on finitely non-zero inputs that have encoding errors before the infinite sequence of zeroes, like $0.0120000\ldots$) – Rob Arthan Mar 02 '25 at 22:24
  • @RobArthan Thanks for your answer, I accepted it. I was actually thinking more and had the following idea, which maybe is simpler (?). An ordered subset $x_1<x_2<...$ of $\mathbb{Z}_+$ can be uniquely represented as a list of numbers with a set of "partition" indices telling you where the breaks are. Any two subsets that map to the same real number must have the same "list," so then to be different we can take some smallest partition index $i$ at which they differ and it will follow that they map to different real numbers. – tree3498 Mar 02 '25 at 23:48
  • Thanks for accepting the answer. Yes, there are lots of possibilities. – Rob Arthan Mar 03 '25 at 20:53