Whatever encoding you invent, I can give you an infinite input stream of bits that makes your decoder hang and never give a definite answer like “yes, this is an integer with such-and-such value” or “no, this isn’t a valid encoding of any integer”.
What if my encoding is: return TRUE(=is an integer) for all inputs?
That’s not such a dumb thing to do. In fact, any encoding that didn’t assign some integer outcome to any sequence of bits would be trivially suboptimal.
The decoder also has to learn the integer’s value. Also, each integer must have at least one bit sequence that decodes to it in finite time. Sorry, it seems I err on the side of conciseness even when I explicitly try to be wordy!
What if my encoding is: return TRUE(=is an integer) for all inputs?
That’s not such a dumb thing to do. In fact, any encoding that didn’t assign some integer outcome to any sequence of bits would be trivially suboptimal.
The decoder also has to learn the integer’s value. Also, each integer must have at least one bit sequence that decodes to it in finite time. Sorry, it seems I err on the side of conciseness even when I explicitly try to be wordy!