Toward the coding theorem with a logarithmic loss #
Over the universal prefix machine PrefixMachine.KB and
the algorithmic probability PrefixMachine.QB. Extends AIT/AlgorithmicProbability.lean.
What this establishes #
The two combinatorial ingredients of the weak coding theorem's codeword and Markov's bound on the
number of level-k requests, none of which needs the decoder's effectiveness:
gammaCode,gammaCode_injective,gammaCode_prefixFree,length_gammaCode: a self-delimiting unary-length header code — a bit-string's own leading run offalses recovers its own length, so nogammaCode kis a proper prefix of another's extension.bitsFixed,ofBitsFixed,length_bitsFixed,ofBitsFixed_bitsFixed: a fixed-width binary code and its inverse.card_exceeds_lt: Markov's bound — fewer than2 ^ kobjects carry mass above2 ^ (-k)under a semimeasure.
What this does NOT establish (flagged) #
- The
O(1)coding theorem and the online Kraft–Chaitin invariant it needs are not attempted here.
The coding theorem itself (coding_theorem_weak) and QB_lsc — the boundaries this module once
flagged, over the bit-string computability layer of CodeLayer/BitStringPrimrec.lean — are
established in AIT/CodingTheoremBitwise.lean and AIT/CodingTheoremDecoder.lean.
A self-delimiting unary-length header code #
A self-delimiting code of a natural: a unary length header (as many falses as natToBits k
is long), a true stop bit, then the binary digits of k themselves.
Equations
Instances For
The serialization is injective.
The serialization is prefix-free.
A fixed-width binary code #
The k-bit binary representation of i, most-significant-bit first, padded with leading
zeros to width k (unlike natToBits, which drops them).
Equations
- PrefixMachine.bitsFixed 0 x✝ = []
- PrefixMachine.bitsFixed k.succ x✝ = PrefixMachine.bitsFixed k (x✝ / 2) ++ [decide (x✝ % 2 = 1)]
Instances For
The inverse of bitsFixed: read a bit-string as a natural, most-significant-bit first.
Equations
- PrefixMachine.ofBitsFixed l = List.foldl (fun (acc : ℕ) (b : Bool) => 2 * acc + b.toNat) 0 l