Documentation

CslibFrontier.Computability.Kolmogorov.PrefixFree

Prefix-free Kolmogorov complexity and the invariance theorem #

A description method M : DescriptionMethod α is prefix-free (M.IsPrefixFree) when its halting domain M.haltingSet = {p | ∃ x, M.Produces p x} is prefix-free in the sense of InformationTheory.IsPrefixFree: no halting program is a strict prefix of another halting program [LV19].

Given any partial recursive code c : Nat.Partrec.Code, ofPrefixCode c dovetails the clocked evaluations of c and accepts a halting pair (q, x) only when q is prefix-incomparable with every previously accepted program. Thus ofPrefixCode c is always both partial recursive and prefix-free, and agrees exactly with ofCode c whenever ofCode c is already prefix-free.

The universal prefix-free description method universalPrefix : DescriptionMethod ℕ parses a strict self-delimiting code header codeHeader c (parseCodeHeader) followed by a program p, and runs p under ofPrefixCode c. Because Set.range codeHeader is prefix-free and each ofPrefixCode c is prefix-free, universalPrefix is prefix-free (isPrefixFree_universalPrefix), partial recursive (isPartrec_universalPrefix), and additively optimal for the class of prefix-free partial recursive description methods (isAdditivelyOptimal_universalPrefix: the prefix-free invariance theorem). Pushing universalPrefix forward along binary-string decoding yields the universal prefix-free description method universalPrefixBits : DescriptionMethod (List Bool) on binary strings.

Main definitions #

Main results #

References #

Strict self-delimiting decoder #

Strict partial decoder for selfDelimitingCode: decodeSelfDelimiting? q = some (b, p) if and only if selfDelimitingCode b ++ p = q.

decodeSelfDelimiting? succeeds with (b, p) exactly when q = selfDelimitingCode b ++ p.

The strict self-delimiting decoder is primitive recursive.

Prefix-free description methods #

The halting set of a description method M: the programs that eventually output some object.

A description method is prefix-free when its halting set is prefix-free: no halting program is a prefix of a distinct halting program.

@[simp]
theorem Cslib.Kolmogorov.DescriptionMethod.haltingSet_map {α : Type u_1} {β : Type u_2} (f : α → β) (M : DescriptionMethod α) :

Strict code-header parser #

Strict parser for codeHeader c ++ p: returns some (c, p) if and only if codeHeader c ++ p = q.

parseCodeHeader q = some (c, p) if and only if codeHeader c ++ p = q.

theorem Cslib.Kolmogorov.DescriptionMethod.prefix_of_parseCodeHeader_eq_some {q₁ q₂ : List Bool} {c₁ c₂ : Nat.Partrec.Code} {p₁ p₂ : List Bool} (h₁ : parseCodeHeader q₁ = some (c₁, p₁)) (h₂ : parseCodeHeader q₂ = some (c₂, p₂)) (hp : q₁ <+: q₂) :
c₁ = c₂ ∧ p₁ <+: p₂

Prefix-free trimming of partial recursive codes #

Candidate (q, x) at dovetailing index k: decodes k to (q, t) and returns (q, x) when Code.evaln t c (encode q) = some x.

The list of prefix-free (program, output) pairs accepted for code c after n dovetailing steps.

The prefix-free restriction of ofCode c: a program p outputs x at stage n if (p, x) appears in prefixAccepted c n.

Every program halting under ofPrefixCode c halts with the same output under ofCode c.

When ofCode c is already prefix-free, ofPrefixCode c has the exact same outputs as ofCode c.

Joint partial recursive evaluation of ofPrefixCode c in (c, p).

The universal prefix-free description method #

The universal prefix-free description method for natural numbers: parseCodeHeader strictly parses a program into codeHeader c ++ p, and then runs p under ofPrefixCode c.

Prefix-free invariance theorem [LV19]: universalPrefix is additively optimal for the class of prefix-free partial recursive description methods of natural numbers.

There exists a code header of universalPrefix that is prefix-incomparable with every halting program of universalPrefix, witnessing haltingSet ≠ univ and Ω < 1.

Prefix-free minorization and binary strings #

The description method U minorizes prefix-free partial recursive decoders: for every partial recursive g : List Bool →. α whose halting domain {p | (g p).Dom} is prefix-free, there is a constant c with K_U(x) ≤ |p| + c whenever x ∈ g p.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.map {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {f : α → β} {s : β → α} (hs : Computable s) (hfs : ∀ (y : β), f (s y) = y) :

Pushing forward along f preserves prefix-free minorization when f has a computable section s.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_ecomplexity_le_of_partrec_eval {α : Type u_1} [Primcodable α] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {M : DescriptionMethod α} (hM_pf : M.IsPrefixFree) {eval : List Bool →. α} (heval : Partrec eval) (hprod : ∀ (p : List Bool) (x : α), M.Produces p x ↔ x ∈ eval p) :
∃ (c : ℕ), ∀ (x : α), U.ecomplexity x ≤ M.ecomplexity x + ↑c

Prefix-free invariance for partial recursive decoders over any Primcodable type.

The universal prefix-free description method for binary strings: universalPrefix, read through the decoding of ℕ.

Prefix-free invariance theorem for binary strings: universalPrefixBits is at most an additive constant worse than every prefix-free description method of binary strings with a partial recursive evaluator.

Self-delimiting upper bound: K(x) ≤ |x| + 2 size |x| + O(1) for every binary string.

Uncomputability and Chaitin's incompleteness for prefix-free complexity #

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_ecomplexity_lt_of_computable {α : Type u_1} [Primcodable α] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {f : α → ℕ} (hf : Computable f) (hunb : ∀ (k : ℕ), ∃ (x : α), k ≤ f x) :
∃ (x : α), U.ecomplexity x < ↑(f x)

No computable unbounded lower bound on prefix-free complexity: if U minorizes prefix-free partial recursive decoders, no computable unbounded function f : α → ℕ satisfies f x ≤ K_U(x) everywhere (Berry's paradox with self-delimiting programs).

A minorizing prefix-free description method on an infinite type with finite complexities cannot have a computable complexity function.

The prefix-free Kolmogorov complexity of natural numbers is not computable.

The prefix-free Kolmogorov complexity of binary strings is not computable.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_forall_le_complexity_universalPrefix_add_of_read {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {read : σ → Option (α × ℕ)} (hread : Computable read) :
∃ (c : ℕ), ∀ (e : Nat.Partrec.Code) (T : σ → Prop), (∀ (t : σ), T t ↔ (e.eval (Encodable.encode t)).Dom) → (∀ (t : σ), T t → ∀ (x : α) (n : ℕ), read t = some (x, n) → ↑n ≤ U.ecomplexity x) → ∀ (t : σ), T t → ∀ (x : α) (n : ℕ), read t = some (x, n) → n ≤ universalPrefix.complexity (Encodable.encode e) + c

Chaitin's incompleteness theorem for prefix-free complexity, quantitative form for theories [Cha74], [LV19]: a sound r.e. theory semi-decided by e proves n ≤ K_U(x) only for n ≤ K(encode e) + c, where K is the prefix-free complexity under universalPrefix.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_forall_le_complexity_universalPrefix_add {α : Type u_1} [Primcodable α] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) :
∃ (c : ℕ), ∀ (e : Nat.Partrec.Code) (S : Set (α × ℕ)), (∀ (xn : α × ℕ), xn ∈ S ↔ (e.eval (Encodable.encode xn)).Dom) → (∀ (x : α) (n : ℕ), (x, n) ∈ S → ↑n ≤ U.ecomplexity x) → ∀ (x : α) (n : ℕ), (x, n) ∈ S → n ≤ universalPrefix.complexity (Encodable.encode e) + c

Chaitin's incompleteness theorem for prefix-free complexity, quantitative form [Cha74], [LV19]: every sound code e semi-deciding pairs (x, n) with n ≤ K_U(x) satisfies n ≤ K(encode e) + c.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_forall_le_of_rePred_of_read {α : Type u_1} {σ : Type u_2} [Primcodable α] [Primcodable σ] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {read : σ → Option (α × ℕ)} (hread : Computable read) {T : σ → Prop} (hT : REPred T) (hsound : ∀ (t : σ), T t → ∀ (x : α) (n : ℕ), read t = some (x, n) → ↑n ≤ U.ecomplexity x) :
∃ (c : ℕ), ∀ (t : σ), T t → ∀ (x : α) (n : ℕ), read t = some (x, n) → n ≤ c

Chaitin's incompleteness theorem for prefix-free complexity: a sound r.e. theory proves n ≤ K_U(x) only for boundedly many n.

theorem Cslib.Kolmogorov.DescriptionMethod.MinorizesPrefixPartrec.exists_forall_le_of_rePred {α : Type u_1} [Primcodable α] {U : DescriptionMethod α} (hU : U.MinorizesPrefixPartrec) {S : Set (α × ℕ)} (hS : REPred fun (x : α × ℕ) => x ∈ S) (hsound : ∀ (x : α) (n : ℕ), (x, n) ∈ S → ↑n ≤ U.ecomplexity x) :
∃ (c : ℕ), ∀ (x : α) (n : ℕ), (x, n) ∈ S → n ≤ c

Chaitin's incompleteness theorem for prefix-free complexity: an r.e. set of pairs (x, n) with n ≤ K_U(x) for every member has bounded n.