The string of length one million can be described in a few words, while a typical string obtained by tossing a coin one million times seems to admit no description shorter than itself. Kolmogorov complexity makes this distinction precise: the complexity of a string is the length of its shortest description, where descriptions are inputs of an algorithm that reconstructs the string. The definition depends on the algorithm, but only up to an additive constant, provided that the algorithm is optimal. This lesson sets up the definition, proves that most strings are incompressible, and shows that the complexity function is not computable.
1.1 Conventions
We work with binary strings . Natural numbers are identified with strings through the length-lexicographic enumeration : the number is the -th string in this list, counting from . The string associated with has length , where denotes the logarithm in base . The number of strings of length less than is .
We fix a computable bijection for coding pairs. All partial computable functions between countable sets of finite objects are understood through these codings.
1.2 Description machines
A machine is a partial computable function . If , the string is an -description of . The complexity of relative to is
with if has no -description.
For instance, the identity machine gives , and the machine , where is the number coded by , describes with about bits. A machine that compresses some strings well may compress others badly; the following notion selects the machines that are optimal up to a constant.
We write if there is a constant such that for every , and if and .
A machine is optimal, or universal, if for every machine there is a constant with for every string , that is, .
There is an optimal machine. If and are optimal, then .
Let be an enumeration of the machines, with through the identification of strings with numbers. Define , and let be undefined on the strings of the form . Every string other than decomposes uniquely as , so is well defined, and it is partial computable by the universality of the enumeration. If is an -description of , then is a -description of of length . So .
If and are optimal, then by optimality of applied to the machine , and symmetrically.
We fix an optimal machine once and for all, and write , the (plain) Kolmogorov complexity of . By the invariance theorem, the statements of the form involving do not depend on this choice. For a number , is the complexity of the string associated with .
- .
- For every partial computable function , for every in the domain of .
- for , and .
- Apply the optimality of to the identity machine.
- The machine satisfies : a shortest -description of is an -description of . Conclude by optimality.
- The first inequality is 1, since the string associated with has length . The second is 2 with .
The second item says that an algorithm cannot create information: the complexity of the output of a computation is bounded by the complexity of its input, up to a constant depending only on the algorithm.
1.3 Incompressible strings
A string is -incompressible if .
For every and , fewer than strings satisfy . In particular, for every there is a string of length with , and at least strings of length are -incompressible.
A string with has a description of length less than , and distinct strings have distinct descriptions, since is a function. There are strings of length less than .
So at least half of the strings of each length are -incompressible, and the proportion of strings of length that can be compressed by more than bits, that is, with , is less than . Incompressibility is the first formal approximation of randomness for finite strings: a string with a regularity that an algorithm can exploit is compressible.
- for : item 2 of Proposition 1.4, applied to the computable function , gives , and item 3 gives .
- If has length and the bits of at odd positions are all , then : a description is the string of the bits at even positions.
- Let be a string of length containing exactly ones. It is determined by , and its rank among the strings of length with ones. When , the number is at most , where is the binary entropy function, and is compressible by a linear number of bits for large . For the bound, let with : the term of index in the binomial expansion of gives , that is, , and since is increasing on . The triple is coded with a logarithmic overhead by the technique of Proposition 1.8 below.
1.4 Pairs
The complexity of a pair is not bounded by the sum of the complexities. A description of followed by a description of does not tell where the first one ends. The length of the first description has to be coded as well.
, where is read as .
For a string , let . A string of the form determines and : read pairs of bits until the first pair . Let be the machine that, on an input of the form , interprets as a number , splits with , and outputs . If and are shortest descriptions of and , and is the string of the number , the input has length , and . Conclude by optimality of .
The logarithmic term cannot be replaced by a constant. Fix . There are pairs with , and their codes are distinct. By the argument of Proposition 1.6, fewer than strings have complexity less than , so one of these pairs satisfies . With such that for every , this pair also satisfies , so the difference is at least , which is unbounded. This defect motivates the prefix-free complexity of a later lesson.
1.5 Non-computability
- The function is not computable. More precisely, if is a partial computable function such that for every in its domain, then is bounded.
- The function is approximable from above: there is a computable function , non-increasing in , with .
- Suppose that is unbounded on its domain. Let be the first string found, in an enumeration of the domain of , with . Then is total computable, and . By Proposition 1.4, . So for some constant and every , which fails for large . If were computable, it would be such a function , and it is unbounded by Proposition 1.6.
- Let be a constant with for every . Let be the least length of a string with and , or if there is none. It is computable, non-increasing in , and equal to from the stage at which a shortest description converges.
The proof formalizes the Berry paradox, “the least number that cannot be defined in fewer than twenty words”: the first string of complexity larger than has a description of length about . Statement 1 says more than non-computability: no algorithm certifies that strings have large complexity, except for finitely many values. This is a form of Gödel’s incompleteness theorem, due to Chaitin. Let be a theory with a c.e. set of axioms that proves only true statements of the form "". Searching through the proofs of enumerates the set of pairs such that proves "". If contained pairs with arbitrarily large second coordinate, the function , the first found such that for some , would be total computable with , and the argument of 1 would give a contradiction. So there is a number such that proves no statement "" with , although all but finitely many strings satisfy .
The approximation from above makes computable in : is the value of at the first stage such that no description shorter than ever converges, and whether a given has this property is the negation of a c.e. condition, which decides. Conversely, computes : this is the second exercise below, after a first exercise that proves the same for the domain of .
1.6 Exercises
Let be the set of strings such that converges. Show that .
Solution
Let be the machine with , where is the least stage with , and undefined elsewhere. Let be such that . If converges at stage , then . With oracle , list the strings of length at most such that converges, compute their outputs, and let be the largest number such that is one of them ( if there is none). Then converges if and only if .
Show that , where is used as an oracle through its graph.
Hint
Adapt the previous solution: when converges at stage , describe with about bits a string of length that has no short description converging by stage .
Solution
Let be the machine defined on the strings as follows: search for the least with , and output the first string of length , in the lexicographic order, such that for no of length less than . Such a string exists, since fewer than strings are outputs of strings of length less than . Let be such that , and let .
With oracle , compute the finite set of strings of length with , and then a stage such that every satisfies for some of length less than ; the search for terminates, since every element of has such a description. If converges at stage , the string satisfies , so , and no description of of length less than converges by stage ; hence . So if and only if . The finitely many are handled by a finite table.
Fix . Show that the set of -incompressible strings is immune: it is infinite and has no infinite c.e. subset.
Solution
contains a string of each length by Proposition 1.6, so it is infinite. If were an infinite c.e. set, the partial computable function with domain would satisfy on its domain, and it would be unbounded, since contains strings of arbitrary length. This contradicts Theorem 1.9.
1.7 Notes and references
Solomonoff (1960–1964), Kolmogorov (1965) and Chaitin (1966) introduced the complexity of strings independently, with different motivations: inductive inference, the definition of information and randomness, and the length of programs. Chaitin’s form of the incompleteness theorem dates from 1974. Kummer (1996) proved that the set of compressible strings is truth-table complete, a stronger form of the second exercise. Li and Vitányi’s book is the standard reference on Kolmogorov complexity.
- A. N. Kolmogorov, Three approaches to the quantitative definition of information, Problems of Information Transmission 1 (1965), 1–7.
- R. J. Solomonoff, A formal theory of inductive inference I, Information and Control 7 (1964), 1–22.
- G. J. Chaitin, Information-theoretic limitations of formal systems, Journal of the ACM 21 (1974), 403–424.
- M. Kummer, On the complexity of random strings, STACS 96, Lecture Notes in Computer Science 1046, Springer, 1996, 25–36.
- M. Li and P. Vitányi, An Introduction to Kolmogorov Complexity and Its Applications, 4th edition, Springer, 2019.