Two-machine invariance of the prior complexity #
The complexity K(R) = r is taken relative to a fixed universal reference machine, and the
reference-machine dependence is a lower-order correction. This file formalizes that caveat as the
two-machine (interpreter) invariance of the additive program-length complexity underlying the
w(R') ∝ 2^{−K(R')} prior.
Carrier verdict (probe-first): the ADDITIVE measure KE, not the index measure KP #
Two candidate carriers were probed:
- (a) the existing prefix measure
KP(PrefixComplexity.KP x = 2·Nat.size (K x + 1), the self-delimiting index bit-length). Walled.KPmeasures the Gödel indexencode c, and Mathlib'sencodeCode (comp cf cg) = 2·(2·Nat.pair (encode cf) (encode cg) + 1) + 4pairs children with the quadraticNat.pair, soNat.size (encode (comp cf cg)) = 2·max (size cf) (size cg) + O(1)and henceKPis multiplicative (factor 2) even atcomp: no additiveKP (I⟦x⟧) ≤ KP x + O(1)exists. The additive-compose target is provably unreachable onKP. - (b) the additive serialization measure
KE(AdditiveComplexity.KE, over the 3-bit Polish lengthelen, additive by construction:elen (comp cf cg) = 3 + elen cf + elen cg). Here the additive-compose bound is native. Chosen.
So the invariance is carried by KE (the additive measure) — the ONLY carrier on which the
additive form is true. The 2^{−KP} prior itself (PrefixComplexity.kraft_prior) is unchanged and
remains the semimeasure. The program-indexed Kraft inequality is machine-checked:
kraft_KP_E proves ∑_c 2^{−elen c} ≤ 1 over Code, from unique decodability of the
Polish E serialization (isUniquelyDecodable_range_E) and its injectivity (E_injective).
The object-indexed prior semimeasure ∑_x 2^{−KE x} ≤ 1 is a distinct statement, and it is
now machine-checked too: kraft_KE reindexes kraft_KP_E along x ↦ minCode x, each
value's own shortest program, injective by minCode_E_injective.
Full unification — that together with a KP_E ↔ KP comparison — remains NOT shipped,
and the comparison is now the whole of what is missing: kraft_plen's Elias telescoping is
specific to plen; and elen vs plen ∘ encode live on incomparable scales (elen is ≈
the log of the index bit-length). Left as a documented follow-on rather than forced.
What this establishes #
computes_comp: the compose eval law inComputesform (interpreterIrun on a programc).KE_interp_le— additive two-machine invariance (compose-method): for an interpreterIwithI.eval x = x',KE x' ≤ KE x + elen I + 3. The interpreter costs only its own additive length plusO(1); no size-of-data term (contrast the general case below).prior_weight_machine_indep_compose— corollary: the prior weight is machine-independent up to the fixed multiplicative constant2^{−(elen I + 3)} = 2^{−O(1)}for a compose-interpreterI:2^{−KE x} · 2^{−(elen I + 3)} ≤ 2^{−KE x'}.
The general-method case (an arbitrary description method reading its argument as a number) is
AdditiveComplexity.invariance_general: d.eval p = x ⟹ KE x ≤ elen d + κ·Nat.size p + (3 + κ)
(κ = 15 + elen dbl) — κ-multiplicative in the data size, because hardcoding the datum p
costs a binary constant of additive length O(Nat.size p). This is the dichotomy: additive
for a program composed as code, multiplicative-in-size for data read as a number. The additive
form for arbitrary methods is barred by the same run-on-0 / AST-data model feature documented
there.
Boundary (the index-measure wall) #
Additive two-machine invariance of the index measure KP remains barred by encodeCode's
quadratic pairing (above) — the reason this item is carried by KE. kraft_KP_E and the
object-indexed kraft_KE are both shipped; the KP_E ↔ KP comparison is not (not a clean
transfer; see the carrier verdict).
Compose eval law in Computes form: if program c outputs x from input 0 and interpreter
I maps x ↦ x', then comp I c outputs x' from input 0
(eval (comp I c) 0 = eval c 0 >>= eval I).
Additive two-machine invariance (compose-method). For an interpreter I with
I.eval x = x', applying I to x costs only I's own additive length plus O(1):
KE x' ≤ KE x + elen I + 3. Take the KE-optimal program cx for x (exists_min_E) and compose
I with it (computes_comp); KE_comp_le on comp I cx gives
KE x' ≤ elen I + elen cx + 3 = KE x + elen I + 3. The absence of any Nat.size-of-data term is
exactly what the additive carrier buys — contrast AdditiveComplexity.invariance_general, whose
κ·Nat.size p is the price of reading the argument as a number.
Machine-independence of the prior weight (compose-interpreters). The prior
weight 2^{−KE} changes by at most the fixed factor 2^{−(elen I + 3)} = 2^{−O(1)} under a
compose-interpreter I (I.eval x = x'): 2^{−KE x} · 2^{−(elen I + 3)} ≤ 2^{−KE x'}. This is
exactly the statement that K(R) = r holds up to the reference-machine constant, a lower-order
correction: the prior is machine-independent up to a multiplicative 2^{−O(1)} for
compose-interpreters. Immediate from KE_interp_le and the antitonicity of a ↦ (2⁻¹)^a on
ℝ≥0∞ (2⁻¹ ≤ 1, pow_le_pow_of_le_one).