0

I'm looking for a pointer to common techniques to map tuples of natural numbers into real or rational numbers such that the ordering is preserved (I assume tuples are ordered lexicographically).

I'm particularly interested in embeddings that map tuples of the form $(n, 0, \dots, 0)$ to $n$.

As an example for pairs, if I have a pair $(n,m)$ I can define $f: (\mathbb{N},\mathbb{N}) \to \mathbb{Q}$ as:

$f(n,m) = n + \frac{m}{m+1}$

and because $\frac{m}{m+1} \in [0;1[$, I have the desired property that $(n_1,m_1) \leq (n_2,m_2) \iff f(n_1,m_1) \leq f(n_2,m_2)$. I also have that $\forall n: f(n,0) = n$.

How does this generalize to tuples of arbitrary (but fixed) arity? Do these embeddings or some instances of such embeddings have well-known names?

Philippe
  • 359
  • OP said tuples ordered lexicographically. – coffeemath Jan 27 '16 at 01:11
  • In fact you can embed the lexicographic order on all finite tuples of natural numbers (which answers every case of fixed arity at once) pretty straightforwardly; see http://math.stackexchange.com/questions/123969/embedding-ordinals-in-mathbbq for more details. – Steven Stadnicki Jan 27 '16 at 01:13
  • @fleablood Maybe since OP was satisfied with lex order on pairs, a lex order on multicomponent tuples would be OK for OP. But I agree OP should clear this up. – coffeemath Jan 27 '16 at 01:14
  • f(n,m,o,p...) = n + $m/2(m+1)$ + $o/4(o+1)$ + $p/8(p+1)$ + ..... ?? Maybe? – fleablood Jan 27 '16 at 01:15
  • @StevenStadnicki good point. I'll clarify the question now to specify what else I'd like to hold (somehow failed to make this explicit) – Philippe Jan 27 '16 at 01:16
  • Sorry, missed the bit where he specified lexicographic order. – fleablood Jan 27 '16 at 01:17
  • Every countable linear order can be embedded in the rationals. – Akiva Weinberger Jan 27 '16 at 01:41
  • 1
    @Philippe This edit doesn't really change the applicability of my comment at all - just map the $(k-1)$-tuple of all but the first coordinate onto $[0,1)$ using your mapping of choice and then add your first coordinate. – Steven Stadnicki Jan 27 '16 at 02:21

1 Answers1

1

How about this: $$(a,b,c)\mapsto0.\underbrace{11\dots11}_{a\text{ 1s}}0\underbrace{11\dots11}_{b\text{ 1s}}0\underbrace{11\dots11}_{c\text{ 1s}}$$ For example, $(3,4,5)$ maps to $0.11101111011111$.

You can consider that number to be written in binary or decimal; changing the base does nothing to the order. However, if you consider it to be binary, we can write it in a much simpler way like this: $$(a,b,c)\mapsto1-2^{-a-1}-2^{-a-b-2}-2^{-a-b-c-2}$$ (If you don't care about your stuff getting mapped to negative numbers, the $1$ in front is unnecessary.)

Here is a picture of what the triples get mapped to. The $x$-axis of each line is the image of a triple. The heights of the lines are only for you to see better; each line has a height of $2^{-a-b-c-1}$.


If you want to have $(a,0,0)$ map to $a$, just make $(a,b,c)$ map to $a+0.\underbrace{1\dots1}_{b\text{ 1s}}0\underbrace{1\dots1}_{c\text{ 1s}}$, so that $(3,4,5)$ maps to $3.1111011111$. Another way to write it would be $(a,b,c)\mapsto a+1-2^{-b-1}-2^{-b-c-1}$.