Flip a fair coin ten times and get ten heads. Flip it again and get
HTHTTHHTHT. Both sequences have probability , yet only one of them
looks like a fair coin. Whatever makes one sequence feel random and the other
not, it has to be a property of the sequence itself, not of the distribution
that produced it.
Kolmogorov complexity is that property, made precise.
The definition#
For a string , look at every program that outputs and halts. The length of the shortest one is the Kolmogorov complexity of :
where is a fixed universal Turing machine and the minimum runs over programs that halt with output .
Three examples calibrate the definition.
- A string of one billion zeros has a tiny program:
print("0" * 10**9). is a few dozen bits, against a billion bits of string. - A short jumble like
j7$kQ2m!xRhas no visible pattern. As far as anyone can tell, the shortest program just prints it literally, so is roughly the length of the string. That is the typical case. - A megabyte of cryptographic PRNG output looks random to every efficient test, but the generator code plus its seed is a few hundred bytes, so of the whole megabyte is a few hundred bytes. Random-looking and algorithmically random are different things, and the gap between them is most of this subject.
You have met in disguise: every compressor is searching for a shorter description of its input. gzip shrinks the zeros to almost nothing and barely touches the jumble. is the limit all compressors reach toward, and as we are about to see, none of them can ever reach it.
Two technical notes that matter later. Programs must halt, otherwise a looping program could be said to "produce" anything at all. And programs are self-delimiting: no program is a prefix of another, as if each one ends with an explicit stop marker.
Why the choice of language doesn't matter#
apparently depends on the programming language. Python and machine code give different lengths for the same string. The invariance theorem dissolves the worry: for any two universal machines and there is a constant , depending only on the pair, with
Pause and try: can you see the one-line proof?
Write an interpreter for in 's language. Its length is the constant . Any program for runs on by prepending the interpreter, so , and by symmetry the other direction holds too. The constant depends on the machine pair, never on the string.
So is well defined up to an additive constant, the same way asymptotic complexity is well defined up to constant factors. For long strings, the choice of language washes out.
Most strings are incompressible#
How many strings can be compressed at all? Count. There are binary strings of length , but the programs shorter than number at most . The programs run out before the strings do, so some string of length has .
The same count says much more: fewer than strings can have , so the fraction of strings within bits of incompressible is at least . At , that is 99.9 percent of all strings. At , the compressible exceptions are one in .
This flips the intuition. Structure is the rare case. A string drawn at random almost certainly has complexity close to its length.
Notice what kind of proof this was: we showed incompressible strings exist by counting, without exhibiting a single one. That is not laziness. It is the next theorem.
You cannot compute K#
The Oxford librarian G. G. Berry pointed Bertrand Russell at a puzzle Russell published in 1906. In one common telling, the phrase
the smallest positive integer not nameable in fewer than twenty English words
names, in twelve words, an integer that supposedly needs twenty. English is too fuzzy for the paradox to bite. Kolmogorov complexity is not.
Suppose were computable. Write the procedure findComplex(L): walk all
strings in order, call on each, return the first with . The
procedure's length is about plus a constant, because only the
encoding of grows. Pick large enough that , and the
procedure becomes a program shorter than that outputs a string whose
complexity exceeds . But of a string is at most the length of any
program producing it. Contradiction. is not computable.
Pause and try: where exactly does the argument use computability of K?
In the loop. findComplex must evaluate to test . If
is merely approximable from above (it is), the loop can never confirm that a
string's complexity exceeds ; it would wait forever on strings whose
compression it hasn't found yet. The contradiction only assembles if can
be computed exactly.
The busy beaver numbers make the cost concrete. is the longest halting time of any -state Turing machine on blank tape: , , , , and , pinned down only in 2024. If we knew all of , we could compute : enumerate every candidate program up to the trivial bound, run each for its busy-beaver budget, and the shortest that outputs is . Since is uncomputable, so is .
Chaitin's incompleteness#
The same argument, run inside a formal theory, proves something stronger. Fix a sound theory (say ZFC) and search all proofs in for one that establishes "" for some specific . The searcher's length is a constant depending on . Choose larger than that constant: if ever proved , the searcher would be a short program producing a string of provably high complexity, the same contradiction as before.
So a sound theory can prove for no specific string, even though the counting argument shows the statement is true for almost all of them. Gödel built one unprovable sentence by self-reference. Chaitin gets an infinite family of true, unprovable statements with no self-reference at all. A finite system cannot certify more information than it contains.
Randomness without probability#
For infinite sequences, the definition you would guess is the right one: a sequence is algorithmically random when every prefix is incompressible, for all . By the Levin-Schnorr theorem this coincides exactly with Martin-Löf's definition from probability theory: passing every effective statistical test. The law of large numbers and its relatives all fall out of incompressibility. Randomness becomes a property of one specific sequence, no distribution required.
The PRNG from earlier shows where the real boundary lies. Its output passes every test you can afford to run, but its prefixes have description length bounded by code plus seed, which never grows. The line is not between and statistics; it is between the tests you can run efficiently and the tests you cannot.
If you remember three things#
- is the length of the shortest halting program for , well defined up to a constant that never depends on the string.
- Almost every string is incompressible, but no specific string can be proved incompressible past a theory-dependent threshold.
- Compression, computability, provability, and randomness are one subject: a finite description can certify only finitely much information.
Discussion
No comments yet. Be the first.