Documentation

CslibFrontier.Computability.Circuit.Boolean.EncodingSize

Bounding the complete binary encoding of a circuit #

A circuit's typed wires bound every binary reference by its input and gate counts. This gives a polynomial bound on its complete serialized code, including gate tags, outputs and framing. It is useful for certifying circuit-construction loops whose intermediate circuits have bounded size, without making a claim about the complexity of the functions those circuits compute.

Main results #

theorem Cslib.Circuits.Boolean.length_encList_encNat_wires_le {n g k L : ℕ} (w : Fin k → Wire n g) (hwire : ∀ (i : Fin k), (Turing.MultiTapeTM.encNat (w i).toNat).length ≤ L) :

A list of wires encodes in length linear in its count. If every wire reference of w has encoded length at most L, the encoded list List.ofFn fun i => (w i).toNat (the arguments of a line or the outputs of a circuit, over any basis) has length at most k * (2 * L + 1).

Every De Morgan gate list has encoded length at most c.size * (23 + 8 * L) whenever every encoded wire reference in c has length at most L.

theorem Cslib.Circuits.Boolean.length_encCode_le {n m : ℕ} (c : Circuit signature n m) :
(encCode c.code).length ≤ 2 * c.size * (23 + 8 * (n + c.size)) + 1 + m * (2 * (n + c.size) + 1)

The full code of a typed De Morgan circuit has polynomially bounded encoded length.