Documentation

Complexity.Computability.Circuit.Boolean.BalancedCode

Native codes for the existing half-split balanced circuit #

The constructor keeps the exact Circuit.balanced topology, including the order of gate blocks. Its private dynamic program fills contiguous-interval rows in increasing interval length. The loop count is the length of the complete leaf-code list, never a binary arity parameter.

Main definitions #

Main results #

The resource proof counts all gates, gate arguments and outputs, including dead gates, and controls the binary lengths of wire references. Thus an arbitrarily large unused input arity does not become a unary resource bound. Every stored interval, invalid-interval fallback, row and table frame is charged; the captured input is charged by the native loop combinator.

References #

Generate the exact half-split code on shared inputs. The supplied fallback is returned only for an empty leaf list. Malformed codes are transformed as data, without arity-sized loops.

Instances For
    theorem Cslib.Circuits.Boolean.balancedCode_eq_code {n r : ℕ} (op : Circuit signature (r + r) r) (unit : Circuit signature n r) (leaves : List (Circuit signature n r)) :
    balancedCode n op.code unit.code (List.map Circuit.code leaves) = (op.balanced unit leaves).code

    Exact raw-code agreement, including empty fallback programs, unused operators, dead gates and the existing half-split order of all intermediate gate blocks.

    Uniform native generation from the binary shared-input count and the complete operator, fallback and leaf codes. The derived bound charges every interval row and its list framing; no well-formedness, fixed arity or assumed construction-runtime bound is required.