InformationTheory

InformationTheory.Shannon.Kolmogorov.UniversalMachine

source

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 — outputs decodeNat bs, so the echo program false :: encodeNat x describes x in natLen x + 1 bits. This gives the C(x) ≤ natLen x + O(1) upper bound and, being total, makes the defining set of condComplexity nonempty (so the infimum is attained).
  • interpret true :: unary(idx) ++ [false] ++ q — runs eval (ofNat Code idx) (Nat.pair (decodeNat q) y), delegating to Mathlib's universal interpreter Nat.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 #

def

InformationTheory.Kolmogorov.parseUnary

source

Read 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
      def

      InformationTheory.Kolmogorov.literalProg

      source
      (x : ) :

      The echo program describing x: flag bit false followed by the binary digits of x.

      Equations
      Instances For
        Used by
          def

          InformationTheory.Kolmogorov.interpretProg

          source
          (idx : ) (q : List Bool) :

          The interpretation program for code index idx running on the description q: flag bit true, then idx in unary terminated by false, then q.

          Equations
          Instances For
            Used by
              noncomputable def

              InformationTheory.Kolmogorov.universalEval

              source
              :
              List BoolPart

              The fixed universal machine. A program is a bit string; the leading bit selects the literal or interpret mode. y is the conditioning input.

              Equations
              Instances For
                Used by
                  def

                  InformationTheory.Kolmogorov.natLen

                  source
                  (x : ) :

                  Bit length of x, the length of the echo program payload.

                  Equations
                  Instances For
                    Used by
                      theorem

                      InformationTheory.Kolmogorov.posLen_le

                      source
                      Used by
                        theorem

                        InformationTheory.Kolmogorov.numLen_le

                        source
                        (m : Num) (hm : 1 m) :
                        Used by
                          theorem

                          InformationTheory.Kolmogorov.natLen_le

                          source
                          (n : ) (hn : 1 n) :
                          2 ^ natLen n 2 * n
                          Used by
                            theorem

                            InformationTheory.Kolmogorov.natLen_le_of_lt_two_pow

                            source
                            (x k : ) (h : x < 2 ^ k) :
                            Used by
                              noncomputable def

                              InformationTheory.Kolmogorov.condComplexity

                              source
                              (x y : ) :

                              Conditional 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
                                  noncomputable def

                                  InformationTheory.Kolmogorov.complexity

                                  source
                                  (x : ) :

                                  Plain Kolmogorov complexity C(x) := C(x | 0).

                                  Equations
                                  Instances For
                                    Used by
                                      theorem

                                      InformationTheory.Kolmogorov.parseUnary_replicate

                                      source
                                      Used by
                                        theorem

                                        InformationTheory.Kolmogorov.literalProg_length

                                        source
                                        (x : ) :
                                        Used by
                                          theorem

                                          InformationTheory.Kolmogorov.interpretProg_length

                                          source
                                          (idx : ) (q : List Bool) :
                                          (interpretProg idx q).length = q.length + (idx + 2)
                                          Used by
                                            theorem

                                            InformationTheory.Kolmogorov.universalEval_literal

                                            source
                                            Used by
                                              theorem

                                              InformationTheory.Kolmogorov.universalEval_interpret

                                              source
                                              Used by
                                                theorem

                                                InformationTheory.Kolmogorov.condComplexity_set_nonempty

                                                source
                                                (x y : ) :
                                                {l : | ∃ (p : List Bool), p.length = l x universalEval p y}.Nonempty
                                                Used by
                                                  theorem

                                                  InformationTheory.Kolmogorov.condComplexity_spec

                                                  source
                                                  (x y : ) :

                                                  The infimum defining condComplexity is attained by an actual program. @audit:ok

                                                  Used by
                                                    theorem

                                                    InformationTheory.Kolmogorov.condComplexity_le_natLen_add_one

                                                    source
                                                    (x y : ) :
                                                    Used by