Contents / Information Theory / Algorithmic Information Theory
Chapter 15
Algorithmic Information Theory
Kolmogorov complexity: the information in a single object, its relationship to entropy, and the results its uncomputability forces.
Introduction
Shannon's theory measures the information in a source: you must hand it a probability distribution before it will say anything. But the objects we actually hold — a file, a genome, the first million digits of — arrive one at a time, with no ensemble attached. Algorithmic information theory answers the question Shannon's theory cannot even ask: how much information is in this object?
The answer, due independently to Solomonoff (1964), Kolmogorov (1965) and Chaitin (1969), is disarmingly simple. The information in is the length of the shortest program that prints . Everything in this chapter — the invariance theorem, the coincidence of the average of with Shannon's , the uncomputability of , Chaitin's incompleteness theorem, Martin-Löf randomness, , and Solomonoff's induction theorem — unfolds from that one definition.
15.1Describing an Individual Object
A description of a string is anything from which the string can be mechanically recovered. To make that precise we fix the decoding machinery first and then ask how short a description can be.
Definition 15.1 (Description method and its complexity). A description method is a partial computable function . A string is a -description of when . The complexity of with respect to is
with when never outputs .
Read as "the programming language": is source code, is what it prints. Nothing so far is canonical — a language with a one-byte instruction for "print the Bible" makes the Bible trivially simple. The content of the subject begins with the observation that this freedom is bounded.
Theorem 15.2 (Invariance theorem). There is a description method — any universal one — such that for every description method there is a constant , depending on but not on , with
Consequently, if and are both universal then for all .
Proof. Enumerate the description methods as — the standard effective enumeration of partial computable functions. Encode the index self-delimitingly as , and define
is partial computable: it reads s until the first , recovers , and simulates on the remainder. The prefix is uniquely readable, so is well defined.
Now take any and any with . Then , so . Set , which depends only on the index of .
For the second claim, apply the first with to get , and again with the roles exchanged to get . Take .∎
Notation. Fix one universal once and for all and write for , the plain Kolmogorov complexity of . Every statement in this chapter has the form " " or " ", and the invariance theorem is exactly what makes such statements independent of that fixed choice.
Pitfall. The constant is uniform in , not small. For any fixed string — say a gigabyte of video — there is a universal machine on which . So " " is a statement about a machine, not about . Only asymptotic statements about infinite families of strings, or comparisons where the same constant appears on both sides, carry machine-independent content.
Two easy upper bounds fix the scale.
Proposition 15.3 (The literal bound). There is a constant with for every .
Proof. Let , the identity, which is computable. Then , and the invariance theorem gives . The constant is the cost of saying "what follows is literal".∎
So no string is harder to describe than to write out; the interesting strings are the ones that are much easier.
Why plain complexity is not the last word
Plain complexity has a defect that shows up as soon as descriptions are combined. If describes and describes , the concatenation does not describe the pair , because cannot tell where stops. Paying to mark the split is what produces the stray logarithms in the theory of , and — as we will see in Martin-Löf Randomness for Infinite Sequences — it also breaks irreparably as a randomness test for infinite sequences.
The repair is to require the descriptions themselves to be self-delimiting.
Definition 15.4 (Prefix-free machine and prefix complexity). A set is prefix-free if no element of is a proper prefix of another. A machine is a prefix machine when its domain is prefix-free. Fixing a universal prefix machine , the prefix complexity of is
The invariance theorem holds verbatim for prefix machines — the proof above goes through once one notes that the index is prefix-free and that the simulated domains are prefix-free — so too is well defined up to .
The reason to pay for self-delimitation is that it buys a probability measure, through the following classical inequality.
Theorem 15.5 (Kraft inequality). If is prefix-free, then
In particular , since the shortest programs for distinct strings are distinct elements of the prefix-free domain of .
Proof. Map each to the half-open interval , where is the binary fraction with digits . The interval consists of exactly those reals whose binary expansion begins with , so its length is .
If neither of is a prefix of the other, they first differ at some position , and no real can begin with both; hence . Prefix-freeness therefore makes a family of pairwise disjoint subintervals of , and the sum of their lengths is at most the length of , which is .∎
Kraft's inequality says that is a sub-probability distribution over strings — the seed of the whole probabilistic side of the theory, taken up in Algorithmic Probability and the Coding Theorem.
The price of self-delimitation is a logarithm in the literal bound.
Proposition 15.6 (Literal bound for prefix complexity). , and more generally . In the other direction .
Proof. For a number written in binary as with , the string is a self-delimiting encoding of of length : a decoder reads digit pairs until it meets the unequal pair . Feed the prefix machine ; it recovers , then reads exactly that many further bits, so its domain is prefix-free, and the invariance theorem for prefix machines gives the first bound. Replacing by a shortest plain program for , of length , gives the second.
For the last inequality, a universal prefix machine is a description method, so by the plain invariance theorem.∎
Intuition. is the size of the smallest zip file of — counting the unzipper as free, since it is the same for everybody. A megabyte of zeros zips to almost nothing; a megabyte from a radioactive-decay source does not zip at all. Kolmogorov complexity is the idealisation of that experiment in which the compressor is allowed to be any program whatsoever, not just the tricks someone happened to ship.
Example 15.8 (Two strings of the same length). Let and let be a string of bits produced by fair coin flips. Bound and estimate .
Solution. For : the program "print exactly times", with hard-coded, consists of a fixed loop plus the binary numeral for . The numeral costs bits, so . Going to zeros raises this only to : grows like .
For : the literal bound gives . In the other direction, Most strings are incompressible shows that fewer than strings of this length have complexity below , so a coin-flipped lands in that set with probability under . With overwhelming probability .
The two lengths are equal and the two complexities differ by a factor of about . That is the point of : it measures structure, not size.□
Example 15.9 (A string that looks random and is not). Let be the first binary digits of . Bound .
Solution. A spigot algorithm computes the digits of from scratch; let be the length of a program implementing it. The program "run the spigot, print the first binary digits", with hard-coded, gives
Writing the digits literally costs bits. Asking instead for the first million digits changes the bound by six bits, from to , while the literal cost rises to . So : the digits of pass every statistical test anyone has run on them and are nonetheless among the least complex strings of their length.□
Remark. That example is the standard warning against reading "algorithmically random" as "looks random". It also explains why is not a repackaging of statistical randomness testing: sees the generating program, while a statistical test sees only the sample.
15.2Algorithmic Probability and the Coding Theorem
Kraft's inequality showed that behaves like a probability. This section turns that observation into a definition, proves the resulting distribution is universal among computable ones, and then proves the theorem that closes the circle: the universal distribution and the shortest program are, to within a constant, the same object.
Imagine feeding the universal prefix machine a stream of fair coin flips. Because 's domain is prefix-free, knows when to stop reading; the probability that it reads exactly the bits of a given program and halts is . The chance that this experiment prints is the sum over all programs that print .
Definition 15.10 (Algorithmic probability). The algorithmic probability, or universal a priori probability, of a string is
the sum being over the prefix-free domain of . By Kraft, .
Notation. A function with is a discrete semimeasure; the inequality is strict for because may fail to halt. A semimeasure is lower semicomputable when some algorithm, given , emits a non-decreasing sequence of rationals converging to — it may never certify the value, but it never over-claims. is lower semicomputable: dovetail all programs and add each time one of them halts with output .
Theorem 15.11 (Universality of the algorithmic prior). For every lower semicomputable semimeasure there is a constant , independent of , with
and one may take , where is the prefix complexity of a program that lower-semicomputes . In particular dominates every computable probability distribution.
Proof. Let be a program of length that enumerates rationals increasing to for each . Build a prefix machine which, having read , runs the following coding scheme.
Using the enumeration, construct a prefix-free code in which receives a codeword of length . Such a code exists and can be built effectively from below: this is the Shannon–Fano–Elias construction, which allocates to a dyadic subinterval of of length inside the interval of mass that the enumeration is filling in. Disjointness of the allocated intervals follows from , and prefix-freeness from disjointness as in Kraft inequality. Let , on a codeword , output the that encodes.
Then , and simulating on costs the description of , which is plus a constant. Hence
and since — the shortest program is one term of the sum — we get .∎
The inequality is why deserves the name a priori. Whatever computable law actually governs the data, has already given a fixed positive share of its mass; no amount of data can drive that share to zero, so a learner who starts from can never be dogmatically wrong about a computable world. The price is paid entirely in the constant : complicated hypotheses start further behind, but never at zero. That is Occam's razor, derived rather than assumed.
The proof extracted along the way. Levin's coding theorem says the converse holds too, and this is much less obvious: it says that the sum over all programs for is dominated, up to a constant factor, by its single largest term.
Theorem 15.12 (Coding theorem).
Proof. One direction is immediate: , because the shortest program contributes to the sum, so .
The other direction is the substantial one, and what follows is a sketch naming what it rests on. Apply Universality of the algorithmic prior with itself — legitimate because is a lower semicomputable semimeasure, which is why that theorem was stated for semimeasures rather than only for computable distributions. The construction inside its proof builds, from the enumeration of from below, a prefix-free code assigning a codeword of length ; running that decoder on costs a further constant, so
The delicate point, which we do not carry out here, is that the code must be built on-line as the approximations to increase, reallocating intervals as they grow. Li and Vitányi give that bookkeeping in full.∎
Intuition. The coding theorem says that if a string has many different short descriptions, then it also has one very short one. The mass could in principle be spread thinly over billions of mediocre programs; the theorem says it cannot be. Algorithmic probability and description length are two views of one quantity: .
Example 15.13 (Weighing two hypotheses). Two programs are in play. = "always print H" has length ; = "print independent fair coin flips" has length . Using as the prior, compute the posterior after observing and the predicted probability that the next symbol is H, for and .
Solution. Priors: and . Likelihoods: and .
Unnormalised posteriors: gets , gets . For these are and , so and
For : gets against 's , so and .
The prediction always lies strictly between and and climbs toward at rate . Note what does the work: not the prior ratio , a fixed handicap, but the likelihood ratio , which grows without bound. The prior only decides how much data is needed to overcome it — exactly the role plays in Universality of the algorithmic prior.□
Pitfall. is a semimeasure, not a measure: strictly, because the missing mass belongs to programs that never halt. Normalising to sum to destroys lower semicomputability, since you would have to know the deficiency — which is , and is uncomputable. Working with semimeasures is not fastidiousness; it is forced.
15.3Chaitin's and the Limits of Proof
The mass that goes missing from Kraft's inequality because programs fail to halt is itself a number, and it turns out to be one of the more remarkable constants in mathematics.
Definition 15.14 (Chaitin's constant). For the fixed universal prefix machine ,
the sum over all on which halts. Equivalently, is the probability that halts when fed fair coin flips.
Proposition 15.15 (Omega is a real in the unit interval, approximable from below). , and there is an algorithm producing a non-decreasing computable sequence of rationals with .
Proof. The domain of is prefix-free, so Kraft gives , and because halts on at least one program. For strictness, some program runs forever — for instance one searching for a proof of a false statement — and its interval, of positive length, is then disjoint from every counted interval, so .
For the approximation, let
Each is a finite sum of dyadic rationals, computable by simulation; the sequence is non-decreasing because the qualifying set grows with ; and it converges to because every halting enters at some finite stage.∎
The approximation converges but gives no rate: at no stage do you know how much mass the still-running programs will eventually contribute. That is precisely the obstruction, and the next theorem turns it into a quantitative statement.
Theorem 15.16 (The first n bits of Omega decide the halting problem). From the first bits of the binary expansion of one can compute, for every program with , whether halts.
Proof. Write for the number given by the first binary digits, so that . Run the approximation of Omega is a real in the unit interval, approximable from below until ; this happens at some finite stage , since .
Claim. Every program of length at most that halts at all has already halted by stage . Suppose some with halts later. Then the total halting mass is at least the already-counted plus the not-yet-counted , giving and contradicting the displayed bound.
So simulating every program of length for steps decides halting for all of them.∎
Corollary 15.17 (Omega is uncomputable and incompressible). is not a computable real, and there is a constant with for every .
Proof. If were computable, The first n bits of Omega decide the halting problem would make the halting problem decidable, contradicting Turing's theorem.
For the second claim, from we can compute the set of halting programs of length , hence the finite set of their outputs; let be the first string not in . Every string of complexity is in , so . This exhibits a program that, given , prints a string of complexity exceeding , so , where the constant is the length of that fixed program. Hence .∎
By the Levin–Schnorr theorem, proved in Martin-Löf Randomness for Infinite Sequences, that last inequality says exactly that the binary expansion of is a Martin-Löf random sequence. So is simultaneously random and meaningful: it encodes the halting problem, and it is lower semicomputable, which no "typical" real is.
now supplies the sharpest available statement of the limits of formal reasoning. The classical Gödel sentence is a single artificial statement; Chaitin's theorem says instead that an entire infinite family of perfectly concrete true statements lies beyond any fixed system, and it names the family.
Theorem 15.19 (Chaitin's incompleteness theorem). Let be a consistent, effectively axiomatised formal system strong enough to express statements of the form " " and sound for them. Then there is a constant , of the order of the length of a program enumerating 's theorems, such that proves no statement " ", for any string — even though all but finitely many strings satisfy .
Proof. Consider the program which, with the number built in, enumerates all proofs of in order and halts, printing , as soon as it finds a proof of a statement " " for some string .
Encode self-delimitingly, so that , where the constant covers the proof enumerator for and the fixed control logic. If halts with output , then has a description of length , so
But proved " ", and is sound for such statements, so . Combining,
Since eventually outgrows , this is false for all large . Fix to be any such . For that the program can never halt, which says exactly that proves no statement " ".
For the final clause, Most strings are incompressible gives that at most strings have .∎
Intuition. A formal system cannot certify randomness far beyond its own description length. If it could, it would be pulling complexity out of thin air: the axioms plus a few bits of search would produce an object provably more complex than the axioms themselves. Chaitin's theorem is the information-theoretic form of "you cannot get more out than you put in".
Example 15.20 (Where the constant sits for a real system). Roughly how large is for a system like ZFC, and what does the theorem forbid in practice?
Solution. The constant is essentially the length of a program that enumerates the theorems of ZFC — the axiom schemas, a proof checker, and the search loop. Written compactly that is on the order of a few thousand bits, and the exact figure is machine-dependent by the invariance theorem.
What is forbidden: ZFC cannot prove, of any specific string , that , even though almost every million-bit string satisfies it, and even though ZFC readily proves the counting statement "all but a fraction of million-bit strings have ". The existence claim is provable; no instance of it is. This is the cleanest known example of a theory proving while proving for no term .□
Pitfall. " is random" does not mean its digits are arbitrary or patternless in the informal sense. They are highly meaningful — they encode the halting problem — and is lower semicomputable, so it is far from a typical real in any computational sense. Algorithmic randomness means "no program much shorter than outputs the first bits", nothing more and nothing less.
15.4Conditional and Joint Complexity
Everything so far measured the cost of describing from nothing. Shannon's theory becomes interesting only once it can condition — , — and the algorithmic theory is the same. This section builds the relative version of and establishes the bounds that the chain rule of Properties of Kolmogorov Complexity will sharpen into equalities.
Notation. Fix a computable pairing bijection , for instance with the self-delimiting encoding of Literal bound for prefix complexity. Natural numbers are identified with binary strings through the standard order , so is meaningful for a number .
Definition 15.21 (Conditional and joint complexity). The conditional prefix complexity of given is
the length of the shortest program that prints when is supplied free of charge on a separate input tape. The joint complexity of and is .
The convention that is free is what makes a complexity in its own right: for each fixed the map is a prefix machine, so an invariance theorem holds for it, with a constant that does not depend on .
Proposition 15.22 (Elementary bounds). For all strings , up to an additive constant independent of and :
Proof. For the first: ignore and run a shortest unconditional program for ; the constant is the cost of the instruction "discard the side information".
For the second: from the pairing is computably invertible, so a shortest program for the pair followed by "take the first component" prints .
For the third — this is where prefix-freeness earns its keep. Let be a shortest program for and a shortest program for given . Feed the machine . Because the domain of is prefix-free, reading consumes exactly , halts with , and control can then be handed to a second phase which reads exactly from the remaining bits and, with in hand, prints . The composite machine has prefix-free domain and prints from bits. With plain complexity this argument fails: cannot tell where ends, and one must pay an extra to mark the boundary.
The fourth follows from the third with Elementary bounds' first inequality, .∎
Intuition. Subadditivity is the statement that describing two things together is never much worse than describing them separately, and is often much better: the shared structure is paid for once. The chain-rule inequality says the natural way to describe a pair is to describe the first, then describe the second in the context of the first — precisely the algorithmic mirror of .
There is a subtlety here with no counterpart in Shannon's theory, and it is the commonest source of confusion in the subject: conditioning on the length of a string is not free.
Proposition 15.23 (Complexity given the length). For every of length ,
and the maximum of over strings of length is , while the maximum of over the same strings is .
Proof. The inequality is Elementary bounds applied to the pair : describe , then describe given .
For the second claim, the upper bound comes from that inequality together with : given , the program "read the next bits and print them" needs no self-delimiting length field. The matching lower bound — that some of length attains it — follows by counting, as in Most strings are incompressible: there are strings and fewer than programs of length below , but the counting must be carried out over the prefix-free domain, where the available programs of each length are limited by Kraft; Li and Vitányi carry out that refinement. We use only the upper bound below.∎
So for a typical -bit string ,
the extra term being the cost of announcing where the string ends. This is why statements about incompressibility come in two flavours, and , and why the second is the technically convenient one.
Example 15.24 (Conditional complexity in three easy cases). Evaluate, to within an additive constant: (a) ; (b) ; (c) , where is a shortest program for .
Solution. (a) : the program "print the side information" has fixed length, independent of .
(b) . Upper bound: describe once and then apply the fixed computable map . Lower bound: by Elementary bounds. The chain rule then charges for the second copy, exactly as charges nothing.
(c) : run the program you were handed. Note that can be genuinely smaller than is large — the point is the converse direction, that need not be , since finding a shortest program for a string you already possess is an uncomputable search.□
Pitfall. Conditioning on and conditioning on are different, and the difference is not a constant: can be as large as of the length. The chain rule of Properties of Kolmogorov Complexity is exact only in the form; in the form it carries an error term. Papers that state it with and claim are wrong.
Example 15.25 (A pair with shared structure). Let be an incompressible string of length , and let be its bitwise complement. Compute and to within .
Solution. Complementation is a fixed computable involution, so : "flip every bit of the side information". By the chain-rule inequality, , and by Elementary bounds, , so .
Contrast the naive count: and are each incompressible, each about bits, and yet the pair costs rather than . Incompressibility of the parts says nothing about incompressibility of the pair, because "random" is not the same as "independent". Two independent incompressible strings, as computed in Properties of Kolmogorov Complexity, do cost .□
15.5The Average of K is the Entropy
Kolmogorov complexity was built without any probability in sight, and Shannon entropy cannot even be evaluated without a distribution. The two are nevertheless the same quantity in the only sense in which they could be: average over a computable source and you recover , up to a constant that pays for describing the source.
Throughout this section is a computable probability distribution on with finite entropy , and denotes the prefix complexity of a program computing .
Theorem 15.26 (Expected complexity equals entropy). For every computable probability distribution ,
with an that depends on neither nor . In particular for any fixed source, and the constant is negligible against for a long sequence.
Proof. Upper bound. Universality of the algorithmic prior, applied to , gave for every . Multiply by and sum:
Lower bound. The shortest programs for distinct strings are distinct elements of the prefix-free domain of , so by Kraft inequality the numbers satisfy . Let , a genuine probability distribution. Since ,
Both terms are non-negative: by Gibbs' inequality, and because . This is Shannon's noiseless coding lower bound, applied to the code whose length function is .∎
The two bounds say that is an optimal code length for every computable source at once, paying only the fixed overhead of naming the source — no code designed for a single can do better on that , and matches all of them simultaneously. That is the algorithmic form of universal compression.
The averaged statement conceals a sharper pointwise one: not merely the mean of but itself tracks the self-information , on all but an exponentially small set.
Theorem 15.27 (K equals self-information with high probability). For every computable and every ,
while holds for every . Hence with probability at least ,
Proof. Let be the set in the display. For the condition rearranges to . Summing over and using Kraft inequality,
The upper bound is the inequality already proved in Universality of the algorithmic prior. Intersecting the two events gives the final display.∎
Intuition. A source emits its typical strings with probability about each, and there are about of them. Indexing that list costs bits, and no shorter description exists for most of the list because there is no room — objects need -bit names. discovers this indexing on its own, without being told ; the only thing it has to be told, at cost , is which list to use.
Example 15.28 (A biased source). A source emits independent bits, each a with probability . Estimate , and bound the probability that a particular emitted string has at least bits below its self-information.
Solution. The binary entropy at is
For independent bits, bits, so Expected complexity equals entropy gives bits — a compression to of the literal bits, and the here is the few dozen bits needed to write down "independent bits with ".
For the tail, K equals self-information with high probability with gives probability at most . Note what this does not say: it does not say the string is close to bits, only close to its own , which varies from string to string. Averaging that variation is what produces .□
Pitfall. is a statement about -random draws, not about strings you chose. Choose from the source above: its self-information is bits, but , roughly bits. No contradiction — sits in the exceptional set, which has probability .
Remark. The analogy is close but not perfect, and the imperfections are instructive. is always non-negative and is always positive; always, but only up to the constant — there are with , since a misleading can be worse than no at all as long as the excess stays inside the constant. And is a function of the distribution while is a function of the outcome: no amount of averaging can recover the individual-object information that carries.
15.6Most Strings Are Incompressible
That some strings are incompressible follows from an argument so short it can be stated in one line: there are more strings than short programs. What makes the observation powerful is that it can be run backwards, and that is the incompressibility method — a counting technique that proves theorems having nothing to do with computability.
Theorem 15.29 (Most strings are incompressible). For every , the number of strings with is at most . Consequently, for every and every , the number of strings of length with is fewer than , so the fraction of -bit strings with
exceeds , a bound that does not depend on .
Proof. A string with has a program of length , and there are such strings of bits in total. Each program, being deterministic, outputs at most one string, so at most distinct strings receive one.
Apply this with : fewer than strings of any length, hence in particular of length , have . There are exactly strings of length , so the compressible fraction is below .∎
Definition 15.30 (Incompressible string). A string is -incompressible if , and incompressible if is taken to be , so that . The same definitions are used with or in place of ; the three notions differ by in the constant, which is immaterial for the applications below.
Corollary 15.31 (Incompressible strings of every length exist). For every there is a string of length with .
Proof. Take in Most strings are incompressible: fewer than strings of length have , and there are of them, so at least one is left over.∎
Intuition. Short descriptions are a scarce resource: there are only about of them below length , and strings competing for them. The pigeonhole principle does the rest. Everything difficult in this chapter comes from the fact that we cannot point to the incompressible strings, only count them.
Method 15.32 (The incompressibility method). To prove that some property holds of almost all objects of size :
- Fix a string of length with ; such exist in abundance by Most strings are incompressible.
- Assume fails for the object encoded by .
- Use the failure of as a regularity: build a description of that exploits it.
- If that description is shorter than , the assumption contradicts incompressibility, so holds.
The method replaces an averaging argument over a probability space by a single, arbitrary, typical object — which is why proofs by incompressibility are usually shorter than the probabilistic proofs they replace.
Example 15.33 (Chaitin's proof that there are infinitely many primes). Use incompressibility to show the set of primes is infinite.
Solution. Suppose there were only finitely many primes, . Every positive integer then factors as , and each exponent satisfies , so fits in bits.
This gives a description of : the list of exponents, each self-delimited, for a total of
But by Most strings are incompressible there are integers of every bit-length with . For large , exceeds , a contradiction. Hence no finite list of primes suffices.
The whole of the number theory used is the fundamental theorem of arithmetic; the counting is done by the complexity bound.□
Theorem 15.34 (Incompressible strings are statistically balanced). Let have length and exactly ones, and suppose . Then
so the number of ones is .
Proof. Describe by giving , then , then the index of in the lexicographic list of the strings of length with ones. Encoding and self-delimitingly costs bits each; the index costs bits. A fixed program reconstructs from these, so
absorbing the two length fields into the single term with a larger constant. The standard entropy bound , with the binary entropy, gives .
Combine with the hypothesis :
Finally, writing , the inequality turns this into , which is the claim.∎
Example 15.35 (How balanced, concretely). Take and . How far from ones can a -incompressible string be?
Solution. Here , so the numerator is . Then
so the count of ones lies in — a relative deviation under . Compare the probabilistic statement: a fair-coin string of this length has its count within of the mean with probability about . The incompressibility bound is slightly weaker and completely deterministic: it holds of every string with , with no probability space anywhere in the argument.□
Pitfall. " is incompressible" is always relative to a slack , and the slack must be fixed before the argument, not chosen afterwards to make it work. A statement like "the string is incompressible, therefore it has no repeated block of length " is only true for small compared with the saving the repetition would buy; spell out that comparison every time.
Remark. Nothing in this section says which strings are incompressible; Most strings are incompressible is a pure counting argument and produces no example. By Chaitin's incompleteness theorem no formal system can supply one either, beyond its own complexity. The incompressibility method finesses this: it never needs a named incompressible string, only the fact that one exists.
15.7The Uncomputability of K
The definition of quantifies over all programs, and so it is no surprise that is not computable. What is worth proving carefully is the shape of the failure: can be approached from one side and not the other, no computable function is an unbounded lower bound for it, and consequently the compressible strings are recognisable while the incompressible ones are not.
Theorem 15.36 (K is upper semicomputable). There is a total computable function , non-increasing in , with for every .
Proof. Define , with the convention — the literal bound of Literal bound for prefix complexity — when the set is empty. Each is computable by simulating finitely many programs for finitely many steps, and the minimum is over a set that only grows with , so the sequence is non-increasing.
It converges to because a shortest program for halts after some finite number of steps, so for all , and it never drops below since every candidate counted is a genuine program for .∎
What the proof does not supply is a stopping rule: at stage you hold an upper bound and no way to know whether it is the truth or whether some program still running will beat it in a billion steps. The next theorem shows that no cleverness repairs this.
Theorem 15.37 (K is not computable). There is no algorithm that halts on every input and outputs .
Proof. Suppose is such an algorithm. For a number , let be the program which, with built in, enumerates the strings in lexicographic order, evaluates on each, and prints the first string with .
Such an exists: by Most strings are incompressible only finitely many strings have complexity below , so the search terminates, and therefore halts.
Encoding self-delimitingly, , where covers the enumerator and and does not depend on . Since prints ,
But by construction , so . Choosing larger than — possible, since outgrows — contradicts this. Hence does not exist.∎
Intuition. This is the Berry paradox — "the least integer not describable in fewer than twenty syllables", a phrase of fewer than twenty syllables — turned from a joke into a theorem. The paradox is defused in ordinary language because "describable" is vague; fix a machine and it becomes precise, and what breaks instead is the assumption that complexity is computable.
Theorem 15.38 (No computable unbounded lower bound). If is a computable function with for all , then is bounded above.
Proof. Suppose is unbounded. Then for each the search for a string with terminates, so the program that enumerates strings and prints the first with halts, and for a constant . Its output satisfies , false for large .∎
Corollary 15.39 (Incompressibility cannot be certified). The set contains no infinite computably enumerable subset, while its complement is computably enumerable.
Proof. The complement is enumerable by dovetailing: run all programs of length below and list each as soon as one of them prints it.
For the first claim, suppose were an infinite c.e. set of incompressible strings, enumerated as . Define — more simply, note that the program "print the first enumerated element of of length at least " has length and outputs a string of complexity at least , which is the same contradiction as above.∎
So the situation is exactly one-sided: you can always discover that a string is compressible, by finding a short program, and you can never establish that it is not. Every practical compressor is a partial implementation of the enumerable half.
Example 15.40 (Why dovetailing does not terminate). You run all programs of length in parallel on a target of length . After a year, the shortest program that has printed has length . What may you conclude about ?
Solution. Only that . The programs still running are the problem: one of length might halt tomorrow with output , and there is no computable bound on how long to wait — that bound would decide the halting problem for length- programs, which by The first n bits of Omega decide the halting problem is equivalent to knowing the first bits of .
Nor can you conclude is compressible in any useful sense: , but the literal bound already gives , so a saving of two bits is within the additive constant and carries no machine-independent content.□
Pitfall. "Uncomputable" is not "unknowable in every instance". is known to within for every , and of any string you can generate by a short program is bounded above tightly. What fails is uniformity: no single algorithm works for all inputs, and lower bounds are unavailable except through counting arguments that name no string.
15.8Properties of Kolmogorov Complexity
The elementary inequalities of Conditional and Joint Complexity become equalities, and the theory acquires the full algebra of Shannon's information measures. The result at the centre is due to Kolmogorov and Levin, and it is the deepest fact in elementary algorithmic information theory.
Theorem 15.41 (Symmetry of information (Kolmogorov–Levin)). Up to an additive constant,
where denotes a fixed shortest program for . Consequently
the information carries about equals the information carries about .
Proof. The inequality was proved in Elementary bounds, in the stronger form with ; since fails in general but is computable from , the version with follows by running to obtain first.
The direction — that the pair cannot be described more cheaply than this two-stage scheme — is the substantial half, and we sketch it, naming what it rests on. Fix and put . Consider the c.e. set , which has at most elements by Most strings are incompressible. Let be the number of with . Knowing and , one can enumerate until pairs with first component appear, and then index among them with bits, giving . Separately, the set of having at least partners in has at most members, and belongs to it, so . Adding the two gives . Removing the logarithmic slack to reach requires carrying and implicitly rather than explicitly, which is Levin's refinement; Li and Vitányi give it in full.
The symmetry statement follows by expanding in both orders — , since the pairing is computably reversible — and cancelling.∎
Definition 15.42 (Algorithmic mutual information).
By symmetry of information, , the number of bits that knowing saves when describing .
Intuition. Read the chain rule as an accounting identity. To buy the pair you first buy ; the receipt you are left holding is then legal tender toward . is the discount. The Shannon identity is the same accounting averaged over an ensemble — and indeed, for a computable joint source, by Expected complexity equals entropy applied three times.
Proposition 15.43 (Information is not increased by computation). For every partial computable and every in its domain,
where is the prefix complexity of a program for . In particular, for a fixed the increase is , and for a computable bijection .
Proof. Concatenate a self-delimiting program for with a shortest program for ; the composite machine runs the second, applies the first, and prints . Prefix-freeness makes the concatenation unambiguous, as in Elementary bounds. For a bijection, apply the bound to and to .∎
This is the algorithmic data-processing inequality, and it has a sharp moral: no amount of post-processing creates information. Running a pseudorandom generator on a -bit seed produces a gigabyte of output whose is at most bits, no matter how random the output looks.
Pitfall. Subadditivity holds only up to the constant, and the constant matters when you iterate. , not : each concatenation pays again. Chains of inequalities in this subject must track how many times the constant is incurred, which is why results are stated with an explicit in the number of pieces.
Example 15.44 (Independent versus dependent pairs). Let and be independently drawn incompressible strings of length , and separately let . Compute , and the corresponding .
Solution. For the independent pair: . Since shares no structure with , , and the chain rule gives
so . (A genuine proof that for some such pair is again a counting argument: fewer than strings have , for each fixed .)
For : by Conditional complexity in three easy cases, so
A string carries about bits of information about itself and bits about an independent string — the algorithmic mirror of and .□
Example 15.45 (The discount from a computable relationship). Let be incompressible of length and let with every bit duplicated, so . Compute and .
Solution. Duplication and its inverse are fixed computable bijections between strings of length and the doubled strings of length , so Information is not increased by computation gives .
Then , since is computed from outright. Hence
Note the contrast with the literal bound: is a -bit string with , so it is compressible by a factor of two — and Incompressible strings are statistically balanced is not violated, because is not incompressible; it is a string with an obvious regularity, which is exactly what the counting bound says almost no string has.□
Remark. Complexity is not monotone along prefixes: can exceed for . Take to be followed by enough zeros: the longer string is easier to describe than its own prefix, because the zeros make the length cheap to state. Any intuition that "more data means more information" must be qualified accordingly.
15.9Martin-Löf Randomness for Infinite Sequences
For a finite string, "random" can only be a matter of degree: a fixed string of length has a fixed , and the choice of slack is a convention. For an infinite sequence the notion becomes sharp, and there is a genuine theorem to prove — that two definitions arrived at from completely different directions, one measure-theoretic and one descriptive, single out exactly the same sequences.
Martin-Löf's definition formalises "passes every statistical test that can actually be carried out".
Definition 15.46 (Martin-Löf test and randomness). A Martin-Löf test is a uniformly computably enumerable sequence of sets of finite strings, whose induced open sets — the sequences having some element of as a prefix — satisfy , where is the uniform (fair-coin) measure.
An infinite sequence passes the test if . It is Martin-Löf random if it passes every such test.
Each is the set of sequences rejected at significance level ; enumerability is what makes the test effective, and the nesting lets the level be pushed arbitrarily low. A sequence that fails the test is rejected at every level — it is a genuine, effectively detectable non-randomness.
Theorem 15.47 (Universal test). There is a Martin-Löf test such that a sequence is Martin-Löf random if and only if it passes . Consequently the set of non-random sequences is a -null set, and almost every sequence is Martin-Löf random.
Proof. Enumerate all candidate tests effectively — a candidate can be forced to satisfy the measure bound by truncating its enumeration whenever the accumulated measure would exceed , which preserves enumerability and only shrinks genuine tests. Set
This is uniformly c.e. as a union of uniformly c.e. sets, and by subadditivity , so is a test. If fails some test then for all , hence for all , so it fails .
For the last claim, has measure at most .∎
Now the descriptive side. The natural guess — call random when its prefixes are incompressible — is false with plain complexity, and the failure is total: it excludes every sequence whatsoever.
Theorem 15.48 (Plain complexity oscillates (Martin-Löf)). For every infinite binary sequence there are infinitely many with
Hence no sequence satisfies " for all ", and plain complexity cannot define randomness for infinite sequences.
Proof. Fix and let , where is the number whose -bit binary representation is . Then the binary representation of is , so from alone a machine recovers and the first bits of .
Therefore, given , the string is determined by its last bits, and
Each produces a distinct , so there are infinitely many such .∎
Prefix complexity repairs exactly this, because its extra makes the length field free, and the repair is precise.
Theorem 15.50 (Levin–Schnorr theorem). An infinite sequence is Martin-Löf random if and only if there is a constant with
Proof. (, contrapositive, in full.) Suppose is not random, so it fails the universal test: for every . Fix . Since , we may enumerate and assign to its -th enumerated string a codeword of length : the strings of have total measure , so by Kraft a prefix-free code with those lengths exists and can be built as the enumeration proceeds. A machine that reads self-delimitingly and then such a codeword prints , giving
Because , some prefix lies in , so . As is arbitrary and outgrows , the deficiency is unbounded, so no constant works.
(, sketch.) Conversely, if the deficiency is unbounded, the sets are uniformly c.e. because is upper semicomputable by K is upper semicomputable, and by Kraft. So is a Martin-Löf test, and fails it. The only point suppressed is the nesting requirement, met by replacing with of the earlier levels.∎
Corollary 15.51 (Random sequences obey the law of large numbers). If is Martin-Löf random then the frequency of ones in tends to .
Proof. The sets , with chosen by Chernoff's bound so that , form a Martin-Löf test; the bound is computable, so the sets are uniformly c.e. A sequence whose frequencies do not converge to lies in every and so fails the test.∎
Intuition. Randomness is the absence of any effectively detectable regularity, and the Levin–Schnorr theorem says that "effectively detectable regularity" and "short description" are the same thing. A regularity you can test for is a regularity you can compress with; a compression you can exhibit is a test the sequence fails.
Example 15.52 (Sorting three sequences). Classify as Martin-Löf random or not: (a) ; (b) the binary expansion of ; (c) the binary expansion of ; (d) a random sequence with every odd-indexed bit replaced by .
Solution. (a) Not random: , so the deficiency is unbounded. It also fails the frequency test only mildly — frequencies do converge to — which shows why Levin–Schnorr is stronger than any single statistical test.
(b) Not random, for the same reason: by A string that looks random and is not. Every computable sequence fails, since computability gives .
(c) Random, by Omega is uncomputable and incompressible together with the Levin–Schnorr theorem.
(d) Not random: the sequence lies in the effectively closed set "odd positions are ", which has measure zero, and the corresponding test is trivially enumerable. Descriptively, .□
Pitfall. Martin-Löf randomness is not the only notion, and the differences are real. Computable randomness (no computable betting strategy wins) and Schnorr randomness (the tests must have computable measure) are strictly weaker; -randomness, defined relative to a halting oracle, is strictly stronger, and is Martin-Löf random but not -random. Claiming "random" without naming the class is meaningless at this level of precision.
15.10Induction, Learning, and the Reach of the Theory
The coding theorem said that algorithmic probability and description length are one quantity. Solomonoff's programme takes that quantity as a prior and derives a theory of prediction from it — arguably the only formal account of induction that requires no assumptions about the world beyond computability.
Prediction needs a measure over infinite sequences rather than over finite strings, so the machine model changes slightly: a monotone machine writes output as it reads input, never retracting, so that longer inputs extend rather than replace earlier output.
Definition 15.53 (Universal monotone semimeasure). For a universal monotone machine , let
the sum being over minimal such . is a semimeasure on sequences: and . Solomonoff's predictor is the conditional
dominates every computable measure exactly as did, by the argument of Universality of the algorithmic prior: for every computable measure . That single inequality is the whole engine of the following theorem.
Theorem 15.54 (Solomonoff's convergence theorem). Let be a computable measure on infinite binary sequences, and let the data be generated by . Then
The sum being finite forces with -probability one: Solomonoff's predictor learns any computable environment, and the total error it ever makes is bounded by the complexity of that environment.
Proof. Let , the relative entropy in nats between the true and predicted distributions on the first symbols. By domination, pointwise, so everywhere and hence
The chain rule for relative entropy expands as the sum over of the expected one-step relative entropies , where is the relative entropy between the true and predicted conditional distributions at step . Pinsker's inequality in the binary case gives in nats. Summing over and using the uniform bound on ,
which is the claim after dividing by and letting . (The absorbs the constant in the domination inequality.)∎
Remark. The claim must be stated honestly, because it is routinely overstated.
- Convergence is -almost sure and in mean square; it says nothing about the sequences of -measure zero, and every specific sequence you might name could be one of them.
- There is no computable bound on when the error becomes small. The bound limits the total error but not its distribution over time, and is itself uncomputable.
- is not computable — it is only lower semicomputable — so Solomonoff induction is not an algorithm. It is an upper bound on what any prediction method could achieve, and a standard against which computable methods are measured.
- The environment must be computable. If the world contains a source of genuine algorithmic randomness that no program simulates, the theorem simply does not apply.
The practical descendants of the theory replace the uncomputable by a computable stand-in, and the substitution is honest as long as one remembers that all such stand-ins are upper bounds.
Definition 15.55 (Minimum description length). The minimum description length principle selects the model minimising
the number of bits to describe the model plus the number of bits to describe the data given the model, where is a fixed computable code — a practical substitute for . The minimum message length principle is the Bayesian variant, with for an explicit prior.
The two terms are the fit-versus-complexity trade-off priced in the same units, which is why MDL requires no separate regularisation parameter.
Example 15.56 (MDL on a curve fit). Model costs bits to describe and leaves residuals costing bits; model costs bits and leaves residuals costing bits. Which does MDL choose, and by what margin does the loser fail?
Solution. bits and bits, so MDL selects by bits.
Read the margin as an accounting statement: bought a -bit reduction in residual cost for a price of extra bits of model. It spent more than it saved, which is exactly what overfitting is — the extra parameters were not paid for by the data. Had 's residuals come in at bits for a model description of only bits, the totals would have been against and MDL would have switched, correctly, to the more complex model.□
Definition 15.57 (Time-bounded complexity and Levin search). Levin's complexity is
Levin search runs every program for steps at stage , dovetailing; it finds a program producing within a factor of optimal time.
Theorem 15.58 (Optimality of Levin search (stated)). For any problem whose solutions can be verified in time , Levin search finds a solution in time , where is any program that solves the problem and is its running time. The constant is multiplicative and independent of the input size.
Remark. is computable — it is the time-bounded quantity, and boundedness is exactly what restores computability. The price is that is no longer machine-independent in the tidy way is: the term shifts by a constant factor under simulation, not a constant summand. It is a working compromise, not a canonical measure.
Definition 15.59 (Normalised information distance). The information distance between and is , and the normalised information distance is
Replacing by the output length of a real compressor gives the computable normalised compression distance
Example 15.60 (NCD on two files). A compressor reports bytes, bytes and bytes. Compute the NCD and interpret it.
Solution.
Interpretation: compressing after costs only bytes instead of the it costs alone, so about of 's compressible content is already predictable from . Values near mean near-identity, values near mean no shared structure. Had the files been unrelated, would have been near and the NCD near .
The sanity check that matters in practice: should come out near , and it does only if has a window long enough to see the repeat. A compressor with a -byte window would report and an NCD near for identical files — an artefact of , not of the mathematics.□
Pitfall. NCD is not an approximation of NID in any controlled sense. is uncomputable and is an upper bound with no bound on the error, so NCD inherits none of NID's metric guarantees; the triangle inequality can fail outright. NCD works in practice because real compressors detect the redundancies real data has, which is an empirical claim about data, not a theorem.
- Confusing with Shannon entropy . is defined for an individual object, for a distribution. They meet only on average, through Expected complexity equals entropy: .
- Treating the invariance constant as small. It is uniform in , but for any single string it can swallow the entire statement. Only asymptotic claims are machine-independent.
- Reading "looks random" as "incompressible". The digits of , and the output of any pseudorandom generator with a short seed, pass every practical statistical test and have complexity .
- Reading "incompressible" as "meaningless". is Martin-Löf random and encodes the halting problem. Algorithmic randomness is a statement about description length, not about significance.
- Believing can be computed, or even lower-bounded, by a compressor. Every compressor gives an upper bound. By No computable unbounded lower bound, no computable function is an unbounded lower bound for , so no experiment certifies incompressibility.
- Confusing plain with prefix . They differ by , which is invisible in most statements and decisive in two: the exact chain rule, which holds only for , and randomness for infinite sequences, where Plain complexity oscillates rules out entirely.
- Forgetting that the length is not free. for typical of length , not ; the term is the difference between and .
- Stating the chain rule with instead of . is false; the error term is , and closing it requires conditioning on a shortest program, not on the string.
- Overstating Solomonoff induction. It converges -almost surely for computable , with no computable rate, and the predictor itself is uncomputable. It is a benchmark, not a method.
- Using MDL or NCD as though they were . They are computable substitutes with uncontrolled error, and their guarantees are empirical.