0
$\begingroup$

I'd like to find an injection $\mathcal{P}(\{0,1\}^*)\to[0,1]$.

By $\mathcal{P}(\{0,1\}^*)$ I mean the powerset of the set of finite sequences over the numbers $0$ and $1$ and by $[0,1]$ I mean the interval of real numbers.

In theoretical computer science $\mathcal{P}(\{0,1\}^*)$ is also known as the set of languages over the alphabet $\{0,1\}$. Proving this injection is one part of proving that $|\mathcal{P}(\{0,1\}^*)|=|[0,1]|$.

Here's what I have done so far:

I build an infinite table $[a_{ij}]_{i,j=1,\ldots,\infty}$. The column labels of the table are the elements of $\{0,1\}^*$ (words) in their canonical order and the row labels are specific subsets (languages) in $\mathcal{P}(\{0,1\}^*)$.

Note: I'm not sure if I'm allowed to use the elements of $\mathcal{P}(\{0,1\}^*)$ as row labels, since I know that they are not enumerable - I'm not sure if this is a problem or not. Assuming not, lets continue:

Now for every row $i$ (language), we let $a_{ij}=1$ if the $j$-th word $w_j\in \{0,1\}^*$ (in canonical order) is in that set (language) and $a_{ij}=0$ otherwise.

So every row is just an infinite bit-string indicating which words are in the language. And we know that for different languages the bit-string will be different. Then for every language we take that bit string $s$ (row) and map it as follows:

$s\mapsto Number(0.s)\in[0,1]$, where $0.s$ is the binary representation of a real number.

The problem with this solution is that it's not an injection. For example the languages specified by the infinite bit-strings $1\overline{0}=10000000000\ldots$ and $0\overline{1}=011111111111111\ldots$ are clearly different, but they will map to the same real number $\frac{1}{2}$, since in binary $0.1\overline{0} = 0.0\overline{1}$.

Is there a solution to fix this? Or do you have another idea for the construction of an injection?

$\endgroup$
3
  • $\begingroup$ How about using the facts that $|\{0,1\}^{\ast}|=|\Bbb{N}|$ and $|[0,1]|=|\Bbb{R}|$? $\endgroup$
    – Servaes
    Commented Oct 30, 2015 at 12:45
  • $\begingroup$ I'm doing this exercise in the context of an optional exercise of a textbook. I think it's fine if I use the first fact. However the second fact would have to be proven, since the textbook hasn't treated this yet. Showing that there is an injection P(N)->[0,1] would be just as fine. $\endgroup$
    – ndrizza
    Commented Oct 30, 2015 at 12:59
  • $\begingroup$ In this case that would just change the labels of the rows/columns of my proof. However, I still have the same problem that two sets are mapped to the same real. $\endgroup$
    – ndrizza
    Commented Oct 30, 2015 at 13:01

2 Answers 2

2
$\begingroup$

Very simply, instead of using the binary expansion, use the ternary expansion (or the decimal expansion if you want, or really anything but the binary expansion). Then $0.111... = 0.2$ is not the image of any other sequence (because you only use 0's and 1's), and the function you have built becomes an injection.

$\endgroup$
1
  • $\begingroup$ Thank you for your answer! $\endgroup$
    – ndrizza
    Commented Oct 30, 2015 at 13:30
0
$\begingroup$

Hint If you want to fix your solution, you can show that the set $$\{ (x,y) \in \mathcal{P}(\{0,1\}^*) \times \mathcal{P}(\{0,1\}^*) | x \neq y, f(x) =f(x) \}$$ is countable.

To do this, show that whenever $f(x)=f(y)$ and $x \neq y$ one of $x$ or $y$ has a finite binary expansion. Show that the words of lenght $n$ are countable, thus this is a countable union of countable sets.

Then, if you denote this set as $\{ (x_n,y_n)\}$ and you have $f(x_n)=f(y_n)=z_n$ you can redefine $$ f(x_n)=z_{2n} \\ f(y_n)=z_{2n+1} $$

This function actually becomes a bijection.

$\endgroup$
1
  • $\begingroup$ Thanks! That works too. However, Najib's answer is a bit simpler. $\endgroup$
    – ndrizza
    Commented Oct 30, 2015 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .