It's said that a computer program "prints" a set $A$ ($A \subseteq \mathbb N$, positive integers.) if it prints every element of $A$ in ascending order (even if $A$ is infinite.). For example, the program can "print":
- All the prime numbers.
- All the even numbers from $5$ to $100$.
- Numbers including "$7$" in them.
Prove there is a set that no computer program can print.
I guess it has something to do with an algorithm meant to manipulate or confuse the program, or to create a paradox, but I can't find an example to prove this. Any help?
Guys, this was given to me by my Set Theory professor, meaning, this question does not regard computer but regards an algorithm that cannot exhaust $\mathcal{P}(\mathbb{N})$. Everything you say about computer or number of programs do not really help me with this... The proof has to contain Set Theory claims, and I probably have to find a set with terms that will make it impossible for the program to print. I am not saying your proofs including computing are not good, on the contrary, I suppose they are wonderful, but I don't really understand them nor do I need to use them, for it's about sets.
There is a really elegant proof for this that requires virtually no math background at all.
All computer programs are a finite sequence of bytes, which is just a number in base 256. So each computer program can be represented as a unique natural number. This statement is elaborated in detail below the divide.
The set of red numbers is a subset of natural numbers. Now write a program that prints this set. Is that program red or blue?
This program is impossible! Therefore, there must exist at least one set which programs can not print.
This is how I learned the Cantor set/subset inequality. I couldn't find a better link, but I got it from a Martin Gardner book.
Addendum
Let's get into the statement
This will involve some math, particularly working in binary. We are going to create a Gödel numbering for computer programs.
Assume every program can be represented as a finite string of 0's and 1's. This accurately describes real world programs and the input to a Universal Turing Machine.
So any given program X is x1x2...xN where xi is 0 or 1 for each i.
Let us define
Num(X)as the binary number 1x1x2...xN.Num(X)of the program X = '0110' would be '10110' in binary, which is 22.Num(X)gives each program a unique natural number because...Num()than the shorter.Num()will differ between the programs.Now we can get on to the set theory part of the proof.
That proof assumed binary, but as long as your program is finitely describable in any language which uses a finite number of characters (like English!) you can similarly map it to a unique natural number. This is interesting because it extends the proof from programs to any describable concept (like genie wishes!).