SHORT POST TIME. Which means I thought of this off-hand (and it’s certainly not new information, but is kind of fun).
Coding theory is concerned with encoding messages in a way so as to minimize their length for transmission over some sort of channel. The mathematical formalization of this goes all the way back to Shannon’s Information Theory, so I’ll give some basics and then mention the RANDOM CONNECTION.
Here’s the idea. We have two parties, Alice and Bob, who are trying to communicate over some sort of digital channel. (For convenience, let’s assume that the channel communicates every message that is sent across without corruption). Alice has a message M that she wants to send, and the message is drawn from some alphabet . Concretely, let’s assume the message is drawn from the English alphabet
where we use # as a placeholder for a blank space. Let denote the set of all messages we can compose out of the symbols in the alphabet . For example,
Now, suppose the channel is binary, so it can only send 0s and 1s. Obviously, Alice needs some way to encode her alphabet into the alphabet to send over pressing messages to Bob.
To bring this about, let’s define a binary code to be a function
That is, a binary code is any map from our source alphabet to a sequence of bits. Note that if we have a binary code C we can easily extend it to messages (i.e. to elements of ) by defining, for any sequence of symbols , the map
Now, most codes are useless. Indeed, under our above definition, the map for every English letter is a code. Unfortunately, if Alice used this code over their channel Bob would have a tough time decoding it.
So, we need some condition that allows us to actually decode the bloody things! We’ll start with a useful type of code called a prefix-free code.
Definition: A binary code is prefix-free if, for every pair of symbols neither is a prefix of nor vice-versa.
An example of a prefix-free binary code (for the first four letters of the English alphabet) could be the following:
Let’s encode a message with C: if Alice encoded the message via C and sent it to Bob, Bob would receive
Now, the beautiful property of prefix-free codes is the following: Bob can actually decode this message online. That is, he can do the following: iterate through each of the bits in sequence, and store what order they came in. Once his stored bit sequence matches a sequence in the code, he can automatically decode that character and keep going!
To illustrate, Bob first reads a 1 off the string. He convinces himself that 1 is not the code for anything, so he reads the next bit, a 0. He now has the string “10″, which is a code for b. Now, is it possible that this could be the beginning of a code for another letter? NO! Because “10″ is the code for b and is not the prefix of any other code. So Bob can translate the b, and move on.
We define nonsingular codes to be the set of codes that can actually be decoded. After seeing the above example, it’s clear that prefix-free codes are non-singular. However, is it possible for there to be non-prefix-free, non-singular codes? That is, are there codes that are decodable, but require us to read the entire message before we can decode them? (NOTE: These codes are practically useless, from an efficiency point of view. This is just a thought experiment to test the definition.)
The answer is YES, and a natural example are Gödel numberings! Here is how it works: for each letter in the alphabet choose a distinct positive integer . Now, to encode a message
let M be the positive integer defined as
where is the nth prime number. We then send the binary expansion of M as our message.
How does Bob decrypt it? Easily: he reads ALL of M, factors it, and reads off the powers of the exponents: the order of the message is preserved if we read off in order of lowest prime to highest, where the power of the ith prime is the code of the ith symbol in the message. Bob has to read all of the message (and he has to make sure he’s transcribed it correctly), or else he cannot recover any of it! Marvelously useless.
OR IS IT USELESS? Similar ideas lurk under regular RSA encryption which everyone uses a billion times a day without even realizing it (thank you blaggerwebs). If factoring integers is as hard as complexity theorists believe it is, then Alice has just sent Bob a frustratingly uncrackable message.