Documentation

AIT.CodingTheorem

Levin's coding theorem, O(1) form #

Over the online Kraft–Chaitin assignment PrefixMachine.kcRun/kcWord of AIT/KraftChaitin.lean and the universal prefix machine PrefixMachine.KB of AIT/PrefixMachine.lean.

What this establishes #

What this does NOT establish (flagged) #

Nothing further is deferred: this closes the boundary AIT/KraftChaitin.lean and AIT/CodingTheoremDecoder.lean both flag.

Nat.size is primitive recursive #

level: the least k clearing the level-k threshold #

def PrefixMachine.level (a : ℕ → ℕ → ℕ) (t y : ℕ) :

The level of y at stage t: the least k with 2 ^ t ≤ 2 ^ k * a t y (k = t suffices once a t y ≥ 1), and 0 when a t y = 0, a case the stream never requests on.

Equations
Instances For

    level's arithmetic: minimality and monotonicity #

    improves: an improving step vs. a silent step #

    def PrefixMachine.improves (a : ℕ → ℕ → ℕ) (m : ℕ) :

    The step improves when a t y > 0 and either t = 0, or a (t - 1) y = 0, or the level dropped.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      levinReq: the total request stream #

      def PrefixMachine.levinReq (a : ℕ → ℕ → ℕ) (m : ℕ) :

      The request stream, total: an improving step asks for its level plus two, a silent step for its own index plus two.

      Equations
      Instances For

        A Finset bound: distinct naturals above (or at) a threshold carry bounded mass #

        levinReq_mass: the stream's partial sums stay at most one #

        theorem PrefixMachine.levinReq_mass {a : ℕ → ℕ → ℕ} {μ : ℕ → ℝ} (ha_mono : ∀ (t x : ℕ), ↑(a t x) / 2 ^ t ≤ ↑(a (t + 1) x) / 2 ^ (t + 1)) (ha_le : ∀ (t x : ℕ), ↑(a t x) / 2 ^ t ≤ μ x) (hnn : ∀ (x : ℕ), 0 ≤ μ x) (hsum : ∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) (N : ℕ) :
        ∑ m ∈ Finset.range N, (1 / 2) ^ levinReq a m ≤ 1

        The budget. The dummies cost less than half and the real requests at most half.

        The KC assignment never repeats a served pair or a served word #

        theorem PrefixMachine.kcWord_injective {req : ℕ → ℕ} (hmass : ∀ (N : ℕ), ∑ m ∈ Finset.range N, (1 / 2) ^ req m ≤ 1) {i i' : ℕ} {w : List Bool} (hi : kcWord req i = some w) (hi' : kcWord req i' = some w) :
        i = i'

        A served word determines its step: kcWord is injective on its some-fibers.

        levinDecode: replay the assignment until the input word is found #

        Replay the assignment until an improving step's word is the input, and output that step's y.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem PrefixMachine.prefixFree_levinDecode_dom {a : ℕ → ℕ → ℕ} {μ : ℕ → ℝ} (ha_mono : ∀ (t x : ℕ), ↑(a t x) / 2 ^ t ≤ ↑(a (t + 1) x) / 2 ^ (t + 1)) (ha_le : ∀ (t x : ℕ), ↑(a t x) / 2 ^ t ≤ μ x) (hnn : ∀ (x : ℕ), 0 ≤ μ x) (hsum : ∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) :

          The domain of the decoder, read as bit-strings, is prefix-free.

          The coding theorem, O(1) form #

          theorem PrefixMachine.coding_theorem {μ : ℕ → ℝ} (hμ : LowerSemicomputable μ) (hnn : ∀ (x : ℕ), 0 ≤ μ x) (hsum : ∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) :
          ∃ (C : ℕ), ∀ (x k : ℕ), (1 / 2) ^ k < μ x → KB x ≤ k + C

          Levin's coding theorem, the upper bound: on the prefix machine every lower-semicomputable semimeasure is an ideal code up to an additive constant.

          theorem PrefixMachine.coding_theorem_QB :
          ∃ (C : ℕ), ∀ (x k : ℕ), (1 / 2) ^ k < QB x → KB x ≤ k + C

          The instance at QB.

          theorem PrefixMachine.coding_theorem_mul {μ : ℕ → ℝ} (hμ : LowerSemicomputable μ) (hnn : ∀ (x : ℕ), 0 ≤ μ x) (hsum : ∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) :
          ∃ (C : ℕ), ∀ (x : ℕ), μ x ≤ 2 ^ C * (1 / 2) ^ KB x

          The coding theorem, multiplicative form, at a general semimeasure: coding_theorem's additive-in-the-exponent bound restated as a multiplicative one, over any lower-semicomputable semimeasure μ (not only QB).

          theorem PrefixMachine.QB_le_two_pow_mul :
          ∃ (C : ℕ), ∀ (x : ℕ), QB x ≤ 2 ^ C * (1 / 2) ^ KB x

          Both directions at QB: with two_pow_neg_KB_le_QB, 2 ^ (-KB x) ≤ QB x ≤ 2 ^ C · 2 ^ (-KB x).

          theorem PrefixMachine.QB_universal {μ : ℕ → ℝ} (hμ : LowerSemicomputable μ) (hnn : ∀ (x : ℕ), 0 ≤ μ x) (hsum : ∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) :
          ∃ (C : ℕ), ∀ (x : ℕ), μ x ≤ 2 ^ C * QB x

          QB is a universal (maximal) lower-semicomputable semimeasure: it dominates every lower-semicomputable semimeasure up to a constant factor. The classical statement fixes its m as ANY maximal such semimeasure, so this shows QB is a universal semimeasure — never "the" universal semimeasure.

          theorem PrefixMachine.QB_universal_nonvacuous :
          ∃ (μ : ℕ → ℝ), LowerSemicomputable μ ∧ (∀ (x : ℕ), 0 ≤ μ x) ∧ (∀ (F : Finset ℕ), ∑ x ∈ F, μ x ≤ 1) ∧ μ 0 = 1

          A witness to the joint satisfiability of QB_universal's hypotheses, beyond the instance the theorem already proves at μ = QB (true there at C = 0) and the instance it makes vacuous at μ = 0 (whose conclusion is 0 ≤ 2 ^ C * QB x): the point mass at 0, lower-semicomputable via the dyadic approximation a t x := if x = 0 then 2 ^ t else 0, is a genuine semimeasure the theorem says something about — it forces 1 ≤ 2 ^ C * QB 0.