Kolmogorov complexity on Mathlib's universal machine #
Kolmogorov complexity K relative to a fixed universal reference machine, with the
invariance-constant caveat. Built directly on Mathlib's
Nat.Partrec.Code (the universal partial-recursive machine Code.eval) and Kleene's recursion
theorem Nat.Partrec.Code.fixed_point₂.
Status: PROVED. A genuine Kolmogorov complexity with its basic API, unboundedness, and uncomputability — on the least-index measure (see the length-measure note).
Length measure: least-INDEX complexity (read this — the value is NOT the bit-length r) #
We take codelen c := Encodable.encode c, the code's index (Gödel number). So K x here is
least-index complexity: the smallest index of a program outputting x. This is a deliberate
pragmatic choice — codelen is then trivially Computable, avoiding a Nat.size-computability
detour.
The bit-length measure is r = Nat.size (encode c) (number of bits of the index).
Relation to this file's measure:
- same minimizer —
Nat.sizeis monotone, so the index-minimizing program is also the bit-length-minimizing one; - but the values differ exponentially: bit-length
r= Nat.size (K_index x)≈ log₂ (K_index x), i.e. this file'sK xis exponentially larger than the bit-lengthr.
Consequently no later step may read this K x as the bit-length r, which is what a bound
in bits refers to. The bit-length refinement Nat.size ∘ encode is the natural companion when
K is later reconnected to r (a separate, deferred step).
The qualitative headlines — uncomputability and unboundedness — transfer to the bit-length
measure unchanged (the recursion-theorem proof never uses the value of codelen, only that it is
computable and that K is unbounded), so they are faithful even though the value is not r.
What this DOES establish #
K: Kolmogorov (least-index) complexity onCode.eval, well-defined viaCode.const x.K_le,exists_min_code,K_le_const: the basic minimization API + a concrete witness.setOf_K_le_finite,K_unbounded: only finitely manyxhaveK x ≤ n; incompressible objects of every complexity exist.K_not_computable: Kolmogorov complexity is uncomputable — via Kleene's recursion theorem (fixed_point₂), so it needs no program-size/encoding bound. (Mathlib'sencodeCodeuses the quadraticNat.pair, which would defeat a Berry-paradox proof; the recursion theorem sidesteps that by handing the self-referential program its own code.)
What this does NOT establish (flagged / other steps) #
- Does NOT relate
Kto an abstract real-valued description length — that would require the bit-length measure (see above), not this index measure. - NOT time-bounded
K_t, whichAIT/KolmogorovTimeBounded.leantreats (theevaln-set is empty for small budgets, soK ≤ K_tneeds budget/nonemptiness care). - NOT two-machine invariance (Mathlib has one fixed
eval; faithful restatement = constant overhead under a computable re-encoding — deferred). - NOT the structure function; NOT prefix-free
Kor the∑ 2^{−K} ≤ 1link — this is plain, not prefix, complexity.
Hypotheses: standard vs added #
- Standard:
Kas least program length forx; uncomputability; unboundedness. - Added / modeling: one fixed machine (
Code.eval) forU_ref(so invariance is deferred); the least-index length measure; the input-0("output from nothing") convention.
Program "length": the code's index (Gödel number). This is the least-index measure; the
bit-length r is Nat.size (encode c) (same minimizer, exponentially smaller value).
Equations
Instances For
Kolmogorov (least-index) complexity on Mathlib's universal machine Code.eval: the least
program length over codes outputting x from input 0. Well-defined — Code.const x computes
x, so the minimand is nonempty.
Equations
- KolmogorovComplexity.K x = sInf {l : ℕ | ∃ (c : Nat.Partrec.Code), KolmogorovComplexity.Computes c x ∧ KolmogorovComplexity.codelen c = l}
Instances For
Any program computing x bounds K x.
K x is achieved by some code.
The trivial generator bound: the constant program witnesses finiteness/totality of K.
Uncomputability of Kolmogorov complexity (the headline). Via Kleene's recursion theorem
(fixed_point₂): were K computable, a self-referential program c₀ could output the least x
with codelen c₀ < K x, forcing K x ≤ codelen c₀ < K x. The recursion theorem supplies c₀
with its own code, so no program-size/encoding bound is needed (sidestepping the quadratic-pairing
blowup of encodeCode).