Documentation

CslibFrontier.Computability.TreeEval.Ary.PackingParameters

Field parameters and encoded storage for packed Cook–Mertz #

For positive fan-in d and Boolean value length b, choose chunk width m = (d*b).size, chunk count r = ⌈b/m⌉, and the least prime p ≥ d*r*(2^m-1)+2. The chunk alphabet embeds in ZMod p, and the packed gate's degree is strictly below p-1.

Bertrand's postulate bounds the bit length of p by 2m+2. The framed binary list encoding of (d+1)*r residues therefore has length at most 9*(d+1)*(b+m). For fixed fan-in this is affine in b; no uniform constant independent of d is asserted.

Main definitions #

Main results #

References #

These are parameter and representation-length bounds. No native prime-search, arithmetic, packed evaluator or implicit gate-query space certificate is proved here.

Bits per chunk: the binary length of the total Boolean input width of a gate.

Number of chunks, with a possibly incomplete final chunk.

Total-degree bound for interpolation on the chunk alphabet.

The least prime strictly above the packed degree plus one. Its search cost is not certified.

The chosen modulus is prime.

Two units of slack keep the degree strictly below the unit-group order.

The sufficient degree threshold is strict, including the smallest parameters.

Bertrand's postulate bounds the least sufficient prime.

theorem Cslib.TreeEval.Ary.Packed.chunkWidth_pos {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

Nonempty gates and values have positive chunk width.

theorem Cslib.TreeEval.Ary.Packed.le_chunkCount_mul {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

The chunks cover all bits of the value.

theorem Cslib.TreeEval.Ary.Packed.chunkCount_mul_lt {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

Padding adds less than one chunk.

theorem Cslib.TreeEval.Ary.Packed.chunkCount_le {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

Positive-width chunks are no more numerous than the original bits.

theorem Cslib.TreeEval.Ary.Packed.chunkCount_pos {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

A nonempty value occupies at least one chunk.

theorem Cslib.TreeEval.Ary.Packed.alphabetSize_lt {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

The whole chunk alphabet fits below the modulus, not just the encoded Boolean values.

def Cslib.TreeEval.Ary.Packed.alphabetEmbedding {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

Embed a chunk as its unsigned value in the selected prime field.

theorem Cslib.TreeEval.Ary.Packed.fieldModulus_size_le {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :

The prime field has at most twice the chunk width plus two bits per residue.

One packed register has linear payload size, including a partial final chunk.

theorem Cslib.TreeEval.Ary.Packed.chunkCount_mul_framed_fieldModulus_size_le {d b : ℕ} (hd : 0 < d) (hb : 0 < b) (c : ℕ) :
chunkCount d b * (c * (fieldModulus d b).size + 1) ≤ (4 * c + 1) * (b + chunkWidth d b)

Framing each residue with c payload copies and one cell marker preserves linear storage. The cases c = 2 and c = 4 account for the flat and padded bank layouts respectively.

theorem Cslib.TreeEval.Ary.Packed.chunkCount_mul_parameter_sizes_le {d b : ℕ} (hd : 0 < d) (hb : 0 < b) :
chunkCount d b * ((fieldModulus d b).size + (2 ^ chunkWidth d b).size + 1) ≤ 12 * (b + chunkWidth d b)

Explicit output-count and alphabet/modulus storage fit one linear bank allowance.

theorem Cslib.TreeEval.Ary.Packed.length_encList_residues_le {d b : ℕ} (hd : 0 < d) (hb : 0 < b) (values : List ℕ) (hlen : values.length ≤ (d + 1) * chunkCount d b) (hres : ∀ v ∈ values, v < fieldModulus d b) :

Actual framed binary storage for the d+1 global registers. All residues, including zero, and their list framing are charged. Any list with at most the full register count is allowed.

For a fixed machine's fan-in, the width term is affine in the value length.

theorem Cslib.TreeEval.Ary.Packed.length_encList_residues_le_affine {d b : ℕ} (hd : 0 < d) (hb : 0 < b) (values : List ℕ) (hlen : values.length ≤ (d + 1) * chunkCount d b) (hres : ∀ v ∈ values, v < fieldModulus d b) :

An explicit affine bound on the encoded global registers when the fan-in is fixed.