InformationTheory.Shannon.Kolmogorov.UniversalMachine
A length-additive universal machine for plain Kolmogorov complexity #
Programs are bit strings (List Bool) and their length is List.length, so
concatenating a fixed prefix is length-additive with no edge cases (unlike the
binary length Nat.size of a natural number, which loses leading zeros).
The fixed universal machine universalEval parses a program in two modes:
- literal
false :: bs— outputsdecodeNat bs, so the echo programfalse :: encodeNat xdescribesxinnatLen x + 1bits. This gives theC(x) ≤ natLen x + O(1)upper bound and, being total, makes the defining set ofcondComplexitynonempty (so the infimum is attained). - interpret
true :: unary(idx) ++ [false] ++ q— runseval (ofNat Code idx) (Nat.pair (decodeNat q) y), delegating to Mathlib's universal interpreterNat.Partrec.Code.eval. Prepending the fixed selector for a machine's code index costs a constant number of bits, which yields the invariance theorem.
Main definitions #
universalEval— the fixed universal machine.condComplexity/complexity— conditional / plain Kolmogorov complexity.
InformationTheory.Kolmogorov.parseUnary
sourceRead a leading run of trues (a unary natural number) terminated by the
first false, returning the count together with the remaining bits.
Equations
Instances For
Used by
InformationTheory.Kolmogorov.literalProg
sourceThe echo program describing x: flag bit false followed by the binary
digits of x.
Instances For
Used by
InformationTheory.Kolmogorov.interpretProg
sourceThe interpretation program for code index idx running on the description
q: flag bit true, then idx in unary terminated by false, then q.
Equations
- InformationTheory.Kolmogorov.interpretProg idx q = true :: (List.replicate idx true ++ false :: q)
Instances For
Used by
InformationTheory.Kolmogorov.universalEval
sourceThe fixed universal machine. A program is a bit string; the leading bit
selects the literal or interpret mode. y is the conditioning input.
Equations
- One or more equations did not get rendered due to their size.
- InformationTheory.Kolmogorov.universalEval [] x✝ = Part.none
- InformationTheory.Kolmogorov.universalEval (false :: bs) x✝ = Part.some (Computability.decodeNat bs)
Instances For
Used by
InformationTheory.Kolmogorov.natLen
sourceBit length of x, the length of the echo program payload.
Equations
Instances For
Used by
InformationTheory.Kolmogorov.posLen_le
sourceUsed by
InformationTheory.Kolmogorov.numLen_le
sourceUsed by
InformationTheory.Kolmogorov.natLen_le
sourceUsed by
InformationTheory.Kolmogorov.natLen_le_of_lt_two_pow
sourceUsed by
InformationTheory.Kolmogorov.condComplexity
sourceConditional Kolmogorov complexity C(x | y): the length of the shortest
program that, run under condition y, outputs x. The literal mode makes the
set nonempty, so this infimum is attained (condComplexity_spec).
Equations
Instances For
Used by
InformationTheory.Kolmogorov.complexity
sourcePlain Kolmogorov complexity C(x) := C(x | 0).
Equations
Instances For
Used by
InformationTheory.Kolmogorov.parseUnary_replicate
sourceUsed by
InformationTheory.Kolmogorov.literalProg_length
sourceUsed by
InformationTheory.Kolmogorov.interpretProg_length
sourceUsed by
InformationTheory.Kolmogorov.universalEval_literal
sourceUsed by
InformationTheory.Kolmogorov.universalEval_interpret
sourceUsed by
InformationTheory.Kolmogorov.condComplexity_set_nonempty
sourceUsed by
InformationTheory.Kolmogorov.condComplexity_spec
sourceThe infimum defining condComplexity is attained by an actual program.
@audit:ok