The index cost of a description #
Provenance: [Discovery] §1.1 (the reference machine) and [Decoupling] Theorem 6.7 (the two currencies, index-length vs. description-length). Registered in [Discovery] §1.1's formalization note as FV row FV-33.
K_bitlen prices a program by its Gödel INDEX's bit-length (codelen', AIT.KolmogorovBitlen),
while KB prices a description by its LENGTH (AIT.PrefixMachine). Mathlib's encodeCode sends
pair a b/comp a b to 4 * Nat.pair (ea) (eb) + O(1), so an index's bit-length DOUBLES at each
node of a code's tree: an arithmetic literal of chain depth size w costs about 2 ^ size w,
which is why no arithmetic literal of the description may appear in a K_bitlen-vs-KB bound. A
BALANCED tree over the description's bits costs only about its leaf count instead, and the
construction here is that tree.
What this establishes #
nestValue,bitNest: fold a bit list into a balanced nest, underNat.pair(naturals) and underCode.pair(codes, withCode.zero/Code.succas the two cheapest leaf codes); the supporting one-round helperspairUp/pairUpCodeand their length bounds.nestUnpack: the depth-indexed inverse, unpairing a value2 ^ htimes into its leaf bits.stripPad: drops trailing padding falses and the markertruea padded description carries.SizeLaw,NestSpec,DecoderSpec: three specifications —codelen''s growth law atpair/comp, the nest's own evaluation/size/round-trip facts, and a decoder reading the padded nest back throughPrefixMachine.univPrefix. All three are proved.SizeLawis proved (sizeLaw, fromencodeCode's own clauses andCodeLayer.Code.SizeArith's bit-length arithmetic);NestSpecis proved (nestSpec, fromsizeLawalone: the fold's own evaluation law by well-founded recursion over aForall₂witness on its leaves, its size law by induction on the depth againstsizeLaw, and its round-trip law by induction on the depth, splitting the bit list at its midpoint and reading the folded value's two halves back out throughNat.unpair_pair);DecoderSpecis proved (decoderSpec, from a codedecoderCodefor the primitive-recursive depth-indexed unpacking (nestUnpack, primitive recursive by iterating a numeric splitting step) composed withPrefixMachine.univPrefix's own partial recursiveness, taken byNat.Partrec.Code.exists_code).K_bitlen_le_32_mul_KB_of: the conditional lemma these three specifications assemble into, proved from them as hypotheses: assembling a minimalKB-description into a padded, depth-tagged nest and running it through the decoder boundsK_bitlen xby32 * KB x + c— the converse, at a constant factor, ofPrefixMachine.KB_le_K_bitlen_add_two_mul_size.K_bitlen_le_32_mul_KB: the index cost of a description, unconditional —sizeLaw,nestSpecanddecoderSpecdischarge every hypothesis ofK_bitlen_le_32_mul_KB_of, soK_bitlen x ≤ 32 * KB x + cholds outright.
What this does NOT establish (flagged) #
codelen'_const_add_three_leis a further consequence, not one of the three specifications itself:Code.constis Mathlib's own unary tower, and its growth law is proved here fromSizeLawby induction.- Registered as [Discovery] §1.1's FV row FV-33; no numbered statement of a paper carries it.
Hypotheses: paper-stated vs added #
- Paper-stated / faithful: none — a formalization note registers the bound (FV-33), no numbered statement does.
- Added / modeling: the balanced-nest encoding of a description (
nestValue/bitNest), the depth-tag-plus-marker-bit padding scheme, and the decoderdecoderCodereading it back throughunivPrefix— none paper-stated, and all ofSizeLaw,NestSpecandDecoderSpecare proved rather than taken as hypotheses.
The balanced nest, over naturals and over codes #
One pairing round: pairs up neighbouring values with Nat.pair, carrying an odd tail value
up unchanged to the next round.
Equations
- ReflectiveSubsystems.pairUp [] = []
- ReflectiveSubsystems.pairUp [x_1] = [x_1]
- ReflectiveSubsystems.pairUp (x_1 :: y :: rest) = Nat.pair x_1 y :: ReflectiveSubsystems.pairUp rest
Instances For
Repeatedly pairUps a list of naturals down to one value.
Equations
- ReflectiveSubsystems.natNestFold [] = 0
- ReflectiveSubsystems.natNestFold [x_1] = x_1
- ReflectiveSubsystems.natNestFold (x_1 :: y :: rest) = ReflectiveSubsystems.natNestFold (ReflectiveSubsystems.pairUp (x_1 :: y :: rest))
Instances For
Folds a bit list into a balanced nest under Nat.pair, pairing neighbours and carrying an
odd tail up.
Equations
Instances For
The Code-valued balanced nest: Code.zero/Code.succ for false/true — the two
cheapest codes in the encoding, evaluating at 0 to the bit they stand for — folded the same way
as nestValue.
Equations
- ReflectiveSubsystems.bitNest bs = ReflectiveSubsystems.codeNestFold (List.map (fun (b : Bool) => if b = true then Nat.Partrec.Code.succ else Nat.Partrec.Code.zero) bs)
Instances For
The depth-indexed inverse: unpairs a value h times into its 2 ^ h leaf bits. Correct
on values built by nestValue/bitNest from a list of length exactly 2 ^ h (NestSpec's third
clause), where no round ever carries an odd tail.
Equations
- ReflectiveSubsystems.nestUnpack 0 x✝ = [decide (x✝ ≠ 0)]
- ReflectiveSubsystems.nestUnpack h.succ x✝ = ReflectiveSubsystems.nestUnpack h (Nat.unpair x✝).1 ++ ReflectiveSubsystems.nestUnpack h (Nat.unpair x✝).2
Instances For
Drops trailing padding falses and then one marker true. Correct on any
base ++ true :: List.replicate k false regardless of base's own content
(stripPad_append_marker_pad), since the marker true stops the trailing-false scan before it
ever reaches base.
Equations
- ReflectiveSubsystems.stripPad bs = (List.drop 1 (List.dropWhile (fun (b : Bool) => !b) bs.reverse)).reverse
Instances For
The three specifications, taken as hypotheses #
codelen''s growth law at pair/comp: pairing/composing two codes costs at most twice
the wider child plus three (the three attained).
Equations
- One or more equations did not get rendered due to their size.
Instances For
SizeLaw, proved. encodeCode's own clauses at pair/comp are 4 * Nat.pair (encodeCode cf) (encodeCode cg) + 4 and + 6; size_four_mul_add_four_le/size_four_mul_add_six_le turn that
+ 4/+ 6 into + 3 bits over the pairing's own bit-length, and size_pair_le_max bounds the
pairing by twice the wider child's bit-length.
The nest's own evaluation, size and round-trip facts.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A decoder reading a depth-tagged, padded nest back through univPrefix.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Code.const's own growth law, proved from SizeLaw #
Code.const is Mathlib's own unary successor tower (const (n + 1) = comp succ (const n)), not
one of the three hypotheses, so its codelen' growth is proved here from SizeLaw.
Code.const h's own codelen' growth law, matching NestSpec's second clause's shape:
proved by induction on h, using SizeLaw's comp clause at each unary step.
DecoderSpec, proved #
The decoder's defining function is partial recursive: univPrefix.eval composed after the
primitive-recursive stripped-nest bits, by Nat.Partrec.Code.eval_part at the constant code
univPrefix.
The decoder, as a code: reads a depth-tagged, padded nest back through univPrefix, taken
by Nat.Partrec.Code.exists_code at partrec_decoderFn.
Equations
Instances For
DecoderSpec, proved. decoderCode reads Nat.pair h V back to univPrefix.eval on the
padded nest's stripped bits, at every h and V — decoderCode's own defining property, read at
Nat.pair h V through Nat.unpair_pair.
The conditional theorem #
The index cost of a description: K_bitlen x ≤ 32 * KB x + c, c carrying only the
decoder's own index. Proved from the three specifications: assemble a KB-minimal
description into a padded, depth-tagged balanced nest, and run it through the decoder U.
The index cost of a description, unconditional. sizeLaw, nestSpec and decoderSpec
discharge every hypothesis of K_bitlen_le_32_mul_KB_of, so K_bitlen x ≤ 32 * KB x + c holds
outright, c carrying only the decoder's own index.