The defects of plain complexity, the logarithmic cost of pairs and the oscillation of initial segments, have a common cause: a description of length conveys, besides its bits, the number . Levin and Chaitin proposed to restrict descriptions to self-delimiting ones: a machine reads its input bit by bit and decides by itself when to stop reading, so that no description is a proper prefix of another. The resulting complexity exceeds by at most a logarithmic term, but it behaves well with respect to concatenation, and it gives a definition of random sequences.
3.1 Prefix-free machines
A set of strings is prefix-free if no element of is a proper prefix of another element of . A machine is prefix-free if its domain is prefix-free. For a prefix-free machine , we write .
The sets and , with the string with each bit doubled, are prefix-free. A prefix-free set corresponds to pairwise disjoint cylinders , . The weight of is .
The weight of a prefix-free set of strings is at most .
It suffices to treat finite prefix-free sets . Let be larger than the length of every element of . The sets , for , are pairwise disjoint, since a string extending two elements of would make them comparable; and the one indexed by has elements. So .
There is a prefix-free machine that is optimal among prefix-free machines: for every prefix-free machine , .
We first transform every machine into a prefix-free one, without changing prefix-free machines. Given an index , let be the machine that, on input , enumerates the domain of in order of convergence, using a fixed dovetailing of the computations , and keeps a list of the strings enumerated so far that have been accepted. A newly enumerated string is accepted if it is incomparable with every string already accepted. converges, with value , if and only if is enumerated and accepted.
The set of accepted strings is prefix-free, by construction, and it is the domain of ; the acceptance of a string does not depend on the input , since the enumeration is the same for all inputs. If the domain of is prefix-free, every enumerated string is accepted, and . An index of is computable from .
Let . The domain of is the union of the sets , which are prefix-free and pairwise incomparable for different ; so is prefix-free. If is prefix-free, .
We fix such a machine and write , the prefix-free complexity of . As for , statements of the form about do not depend on the choice of , and denotes the complexity of the string associated with . The proofs of Proposition 1.4 (2) and of Theorem 1.9 carry over: for partial computable , since the domain of the machine is contained in that of , hence prefix-free; is not computable; and is approximable from above, with the computable bound , given by the prefix-free machine , in place of .
3.2 Properties of K
- .
- , and for .
- , and , where is read as .
- .
- Let be the machine that, on input , searches for a decomposition with in the domain of , and outputs . The decomposition is unique when it exists, since the domain of is prefix-free; it is found by enumerating the domain of and testing the prefixes of . The domain of is prefix-free: if and are both in it and comparable, then and are comparable elements of the domain of , hence equal, and then and are comparable, hence equal. Concatenating shortest descriptions of and gives .
- The machine that, on input with in the domain of and , read as a number, outputs , is prefix-free, by the same argument as in 1. It gives the first inequality. For the second, for : the prefix-free machine describes the string associated with with bits.
- is a machine, so . For the second inequality, let be the machine that, on input with in the domain of and , outputs , where is the optimal plain machine defining . It is prefix-free, and a shortest -description of the number followed by a shortest -description of is an -description of . The last inequality follows from the bound of 2, the finitely many strings with being absorbed in the constant.
- The shortest -descriptions of distinct strings are distinct elements of the domain of , so the sum is at most the weight of the domain of , which is at most by Proposition 3.2.
Property 4 is the essential difference with plain complexity: diverges, since there are strings of length with , so that the sum over each length is bounded from below by a positive constant. It implies that exceeds the length infinitely often.
For every there is a string with . More precisely, for every there is a string of length with , for a constant independent of .
For the first statement: if for every , then for every , and the sum over all lengths diverges, contradicting Proposition 3.4 (4). The second statement is proved in the next lesson (Theorem 4.5).
By Proposition 3.4 (2) and the corollary, the maximal complexity of a string of length is , and it exceeds by an unbounded amount, since is unbounded. The term is the cost of self-delimitation: a prefix-free description of must also determine where it ends, which requires information about .
3.3 Prefix-free complexity of initial segments
The proof of Theorem 2.3 does not carry over to : the machine in its proof, , is not prefix-free, since it accepts every string. In the next course, a sequence is called random when for some constant and every . That course proves that such sequences exist, and in fact that almost every sequence, in the sense of the uniform measure, is random; the next lesson gives an example, Chaitin’s number . Computable sequences are far from random, since .
If is computable, then .
As for Proposition 2.1: and are computable, and partial computable functions do not increase by more than a constant.
Unlike the case of , the converse fails: there are non-computable sequences with , the K-trivial sequences, a central topic of the theory of algorithmic randomness.
3.4 Exercises
Show that . Show that is not monotone up to a constant on numbers: there are pairs with tending to .
Solution
The first inequality follows from Proposition 3.4 (1), since is computable. For the second, let be a number whose associated string has length and satisfies , by Proposition 1.6; then for a constant , by Proposition 3.4 (3). Such numbers lie between and . Let , computable from , so that for . Then tends to .
Show that for , and more generally that every iteration of the bound improves the upper bound on .
Solution
By Proposition 3.4 (2) applied to the string associated with , of length , . Applying (2) again to with the bound gives for . Then . Iterating, , each stage replacing a term by .
3.5 Notes and references
Prefix-free complexity was introduced by Levin (1974) and Chaitin (1975), with a related notion due to Gács. The Kraft inequality is a classical result of information theory (1949). The definition of randomness through and its equivalence with Martin-Löf randomness are due to Levin, Schnorr and Chaitin, and are treated in the next course. K-trivial sequences were introduced by Chaitin and studied by Solovay, and later by Downey, Hirschfeldt, Nies and Stephan.
- L. A. Levin, Laws of information conservation (nongrowth) and aspects of the foundation of probability theory, Problems of Information Transmission 10 (1974), 206–210.
- G. J. Chaitin, A theory of program size formally identical to information theory, Journal of the ACM 22 (1975), 329–340.
- L. G. Kraft, A device for quantizing, grouping, and coding amplitude modulated pulses, Master’s thesis, MIT, 1949.
- R. G. Downey and D. R. Hirschfeldt, Algorithmic Randomness and Complexity, Springer, 2010.